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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "base/sequenced_task_runner_helpers.h" |
14 #include "webkit/fileapi/file_system_types.h" | 15 #include "webkit/fileapi/file_system_types.h" |
15 #include "webkit/quota/special_storage_policy.h" | 16 #include "webkit/quota/special_storage_policy.h" |
16 | 17 |
17 class FilePath; | 18 class FilePath; |
18 class GURL; | 19 class GURL; |
19 | 20 |
20 namespace base { | 21 namespace base { |
21 class MessageLoopProxy; | 22 class MessageLoopProxy; |
22 } | 23 } |
23 | 24 |
(...skipping 25 matching lines...) Expand all Loading... |
49 : public base::RefCountedThreadSafe<FileSystemContext, | 50 : public base::RefCountedThreadSafe<FileSystemContext, |
50 DefaultContextDeleter> { | 51 DefaultContextDeleter> { |
51 public: | 52 public: |
52 FileSystemContext( | 53 FileSystemContext( |
53 scoped_refptr<base::MessageLoopProxy> file_message_loop, | 54 scoped_refptr<base::MessageLoopProxy> file_message_loop, |
54 scoped_refptr<base::MessageLoopProxy> io_message_loop, | 55 scoped_refptr<base::MessageLoopProxy> io_message_loop, |
55 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, | 56 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, |
56 quota::QuotaManagerProxy* quota_manager_proxy, | 57 quota::QuotaManagerProxy* quota_manager_proxy, |
57 const FilePath& profile_path, | 58 const FilePath& profile_path, |
58 const FileSystemOptions& options); | 59 const FileSystemOptions& options); |
59 ~FileSystemContext(); | |
60 | 60 |
61 // This method can be called on any thread. | 61 // This method can be called on any thread. |
62 bool DeleteDataForOriginOnFileThread(const GURL& origin_url); | 62 bool DeleteDataForOriginOnFileThread(const GURL& origin_url); |
63 bool DeleteDataForOriginAndTypeOnFileThread(const GURL& origin_url, | 63 bool DeleteDataForOriginAndTypeOnFileThread(const GURL& origin_url, |
64 FileSystemType type); | 64 FileSystemType type); |
65 | 65 |
66 quota::QuotaManagerProxy* quota_manager_proxy() const { | 66 quota::QuotaManagerProxy* quota_manager_proxy() const { |
67 return quota_manager_proxy_.get(); | 67 return quota_manager_proxy_.get(); |
68 } | 68 } |
69 | 69 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 // MountPointProvider for the URL and call the provider's CreateFileReader. | 124 // MountPointProvider for the URL and call the provider's CreateFileReader. |
125 // The resolved MountPointProvider could perform further specialization | 125 // The resolved MountPointProvider could perform further specialization |
126 // depending on the filesystem type pointed by the |url|. | 126 // depending on the filesystem type pointed by the |url|. |
127 webkit_blob::FileReader* CreateFileReader( | 127 webkit_blob::FileReader* CreateFileReader( |
128 const GURL& url, | 128 const GURL& url, |
129 int64 offset, | 129 int64 offset, |
130 base::MessageLoopProxy* file_proxy); | 130 base::MessageLoopProxy* file_proxy); |
131 | 131 |
132 private: | 132 private: |
133 friend struct DefaultContextDeleter; | 133 friend struct DefaultContextDeleter; |
| 134 friend class base::DeleteHelper<FileSystemContext>; |
| 135 ~FileSystemContext(); |
| 136 |
134 void DeleteOnCorrectThread() const; | 137 void DeleteOnCorrectThread() const; |
135 | 138 |
136 scoped_refptr<base::MessageLoopProxy> file_message_loop_; | 139 scoped_refptr<base::MessageLoopProxy> file_message_loop_; |
137 scoped_refptr<base::MessageLoopProxy> io_message_loop_; | 140 scoped_refptr<base::MessageLoopProxy> io_message_loop_; |
138 | 141 |
139 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; | 142 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; |
140 | 143 |
141 // Mount point providers. | 144 // Mount point providers. |
142 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; | 145 scoped_ptr<SandboxMountPointProvider> sandbox_provider_; |
143 scoped_ptr<IsolatedMountPointProvider> isolated_provider_; | 146 scoped_ptr<IsolatedMountPointProvider> isolated_provider_; |
144 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; | 147 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_; |
145 | 148 |
146 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); | 149 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); |
147 }; | 150 }; |
148 | 151 |
149 struct DefaultContextDeleter { | 152 struct DefaultContextDeleter { |
150 static void Destruct(const FileSystemContext* context) { | 153 static void Destruct(const FileSystemContext* context) { |
151 context->DeleteOnCorrectThread(); | 154 context->DeleteOnCorrectThread(); |
152 } | 155 } |
153 }; | 156 }; |
154 | 157 |
155 } // namespace fileapi | 158 } // namespace fileapi |
156 | 159 |
157 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ | 160 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ |
OLD | NEW |