OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
7 | 7 |
8 #include <map> | |
8 #include <string> | 9 #include <string> |
9 | 10 |
10 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/file_path.h" | |
tzik
2012/05/10 08:31:00
Forward declaration looks still enough.
Could we r
kinuko
2012/05/11 06:59:34
Done.
| |
11 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
13 #include "base/platform_file.h" | 15 #include "base/platform_file.h" |
14 #include "base/sequenced_task_runner_helpers.h" | 16 #include "base/sequenced_task_runner_helpers.h" |
15 #include "webkit/fileapi/file_system_types.h" | 17 #include "webkit/fileapi/file_system_types.h" |
16 #include "webkit/quota/special_storage_policy.h" | 18 #include "webkit/quota/special_storage_policy.h" |
17 | 19 |
18 class FilePath; | |
19 class GURL; | 20 class GURL; |
20 | 21 |
21 namespace base { | 22 namespace base { |
22 class SequencedTaskRunner; | 23 class SequencedTaskRunner; |
23 class SingleThreadTaskRunner; | 24 class SingleThreadTaskRunner; |
24 } | 25 } |
25 | 26 |
26 namespace quota { | 27 namespace quota { |
27 class QuotaManagerProxy; | 28 class QuotaManagerProxy; |
28 } | 29 } |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 // Creates new FileReader instance to read a file pointed by the given | 129 // Creates new FileReader instance to read a file pointed by the given |
129 // filesystem URL |url| starting from |offset|. | 130 // filesystem URL |url| starting from |offset|. |
130 // This method internally cracks the |url|, get an appropriate | 131 // This method internally cracks the |url|, get an appropriate |
131 // MountPointProvider for the URL and call the provider's CreateFileReader. | 132 // MountPointProvider for the URL and call the provider's CreateFileReader. |
132 // The resolved MountPointProvider could perform further specialization | 133 // The resolved MountPointProvider could perform further specialization |
133 // depending on the filesystem type pointed by the |url|. | 134 // depending on the filesystem type pointed by the |url|. |
134 webkit_blob::FileReader* CreateFileReader( | 135 webkit_blob::FileReader* CreateFileReader( |
135 const GURL& url, | 136 const GURL& url, |
136 int64 offset); | 137 int64 offset); |
137 | 138 |
139 // Register a filesystem provider. The ownership of |provider| is | |
140 // transferred to this instance. | |
141 void RegisterMountPointProvider(FileSystemType type, | |
142 FileSystemMountPointProvider* provider); | |
143 | |
138 private: | 144 private: |
139 friend struct DefaultContextDeleter; | 145 friend struct DefaultContextDeleter; |
140 friend class base::DeleteHelper<FileSystemContext>; | 146 friend class base::DeleteHelper<FileSystemContext>; |
141 ~FileSystemContext(); | 147 ~FileSystemContext(); |
142 | 148 |
143 void DeleteOnCorrectThread() const; | 149 void DeleteOnCorrectThread() const; |
144 | 150 |
145 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 151 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
146 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; | 152 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
147 | 153 |
148 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 154 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
149 | 155 |
150 // Mount point providers. | 156 // Regular mount point providers. |
151 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; | 157 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; |
152 scoped_ptr<IsolatedMountPointProvider> isolated_provider_; | 158 scoped_ptr<IsolatedMountPointProvider> isolated_provider_; |
153 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; | 159 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; |
154 | 160 |
161 // Registered mount point providers. | |
162 std::map<FileSystemType, FileSystemMountPointProvider*> provider_map_; | |
163 | |
155 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 164 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
156 }; | 165 }; |
157 | 166 |
158 struct DefaultContextDeleter { | 167 struct DefaultContextDeleter { |
159 static void Destruct(const FileSystemContext* context) { | 168 static void Destruct(const FileSystemContext* context) { |
160 context->DeleteOnCorrectThread(); | 169 context->DeleteOnCorrectThread(); |
161 } | 170 } |
162 }; | 171 }; |
163 | 172 |
164 } // namespace fileapi | 173 } // namespace fileapi |
165 | 174 |
166 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 175 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |