Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: webkit/browser/fileapi/sandbox_context.h

Issue 21305005: FileAPI: Move OpenFileSystem into SandboxContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/browser/fileapi/sandbox_context.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_BROWSER_FILEAPI_SANDBOX_CONTEXT_H_ 5 #ifndef WEBKIT_BROWSER_FILEAPI_SANDBOX_CONTEXT_H_
6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_CONTEXT_H_ 6 #define WEBKIT_BROWSER_FILEAPI_SANDBOX_CONTEXT_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/memory/weak_ptr.h"
16 #include "base/time/time.h"
15 #include "webkit/browser/fileapi/file_system_backend.h" 17 #include "webkit/browser/fileapi/file_system_backend.h"
16 #include "webkit/browser/fileapi/file_system_options.h" 18 #include "webkit/browser/fileapi/file_system_options.h"
17 #include "webkit/browser/fileapi/file_system_quota_util.h" 19 #include "webkit/browser/fileapi/file_system_quota_util.h"
18 #include "webkit/browser/webkit_storage_browser_export.h" 20 #include "webkit/browser/webkit_storage_browser_export.h"
19 21
20 namespace base { 22 namespace base {
21 class SequencedTaskRunner; 23 class SequencedTaskRunner;
22 } 24 }
23 25
24 namespace quota { 26 namespace quota {
25 class QuotaManagerProxy; 27 class QuotaManagerProxy;
26 class SpecialStoragePolicy; 28 class SpecialStoragePolicy;
27 } 29 }
28 30
29 namespace fileapi { 31 namespace fileapi {
30 32
31 class AsyncFileUtilAdapter; 33 class AsyncFileUtilAdapter;
32 class FileSystemURL; 34 class FileSystemURL;
33 class FileSystemUsageCache; 35 class FileSystemUsageCache;
34 class ObfuscatedFileUtil; 36 class ObfuscatedFileUtil;
35 class SandboxFileSystemBackend; 37 class SandboxFileSystemBackend;
36 class SandboxFileSystemTestHelper; 38 class SandboxFileSystemTestHelper;
37 class SandboxQuotaObserver; 39 class SandboxQuotaObserver;
38 40
39 // This class keeps and provides a sandbox file system context. 41 // This class keeps and provides a sandbox file system context.
40 // An instance of this class is created and owned by FileSystemContext. 42 // An instance of this class is created and owned by FileSystemContext.
41 class WEBKIT_STORAGE_BROWSER_EXPORT SandboxContext { 43 class WEBKIT_STORAGE_BROWSER_EXPORT SandboxContext {
42 public: 44 public:
45 typedef FileSystemBackend::OpenFileSystemCallback OpenFileSystemCallback;
46
43 // The FileSystem directory name. 47 // The FileSystem directory name.
44 static const base::FilePath::CharType kFileSystemDirectory[]; 48 static const base::FilePath::CharType kFileSystemDirectory[];
45 49
46 // Origin enumerator interface. 50 // Origin enumerator interface.
47 // An instance of this interface is assumed to be called on the file thread. 51 // An instance of this interface is assumed to be called on the file thread.
48 class OriginEnumerator { 52 class OriginEnumerator {
49 public: 53 public:
50 virtual ~OriginEnumerator() {} 54 virtual ~OriginEnumerator() {}
51 55
52 // Returns the next origin. Returns empty if there are no more origins. 56 // Returns the next origin. Returns empty if there are no more origins.
(...skipping 28 matching lines...) Expand all
81 // specified by |origin_url| and |type|. 85 // specified by |origin_url| and |type|.
82 // (The path is similar to the origin's root path but doesn't contain 86 // (The path is similar to the origin's root path but doesn't contain
83 // the 'unique' part.) 87 // the 'unique' part.)
84 // Returns an empty path if the given type is invalid. 88 // Returns an empty path if the given type is invalid.
85 // This method can only be called on the file thread. 89 // This method can only be called on the file thread.
86 base::FilePath GetBaseDirectoryForOriginAndType( 90 base::FilePath GetBaseDirectoryForOriginAndType(
87 const GURL& origin_url, 91 const GURL& origin_url,
88 FileSystemType type, 92 FileSystemType type,
89 bool create); 93 bool create);
90 94
95 // FileSystemBackend helpers.
96 void OpenFileSystem(
97 const GURL& origin_url,
98 FileSystemType type,
99 OpenFileSystemMode mode,
100 const OpenFileSystemCallback& callback,
101 const GURL& root_url);
102
91 // FileSystemQuotaUtil helpers. 103 // FileSystemQuotaUtil helpers.
92 base::PlatformFileError DeleteOriginDataOnFileThread( 104 base::PlatformFileError DeleteOriginDataOnFileThread(
93 FileSystemContext* context, 105 FileSystemContext* context,
94 quota::QuotaManagerProxy* proxy, 106 quota::QuotaManagerProxy* proxy,
95 const GURL& origin_url, 107 const GURL& origin_url,
96 FileSystemType type); 108 FileSystemType type);
97 void GetOriginsForTypeOnFileThread( 109 void GetOriginsForTypeOnFileThread(
98 FileSystemType type, 110 FileSystemType type,
99 std::set<GURL>* origins); 111 std::set<GURL>* origins);
100 void GetOriginsForHostOnFileThread( 112 void GetOriginsForHostOnFileThread(
101 FileSystemType type, 113 FileSystemType type,
102 const std::string& host, 114 const std::string& host,
103 std::set<GURL>* origins); 115 std::set<GURL>* origins);
104 int64 GetOriginUsageOnFileThread( 116 int64 GetOriginUsageOnFileThread(
105 FileSystemContext* context, 117 FileSystemContext* context,
106 const GURL& origin_url, 118 const GURL& origin_url,
107 FileSystemType type); 119 FileSystemType type);
108 void InvalidateUsageCache( 120 void InvalidateUsageCache(
109 const GURL& origin_url, 121 const GURL& origin_url,
110 FileSystemType type); 122 FileSystemType type);
111 void StickyInvalidateUsageCache( 123 void StickyInvalidateUsageCache(
112 const GURL& origin_url, 124 const GURL& origin_url,
113 FileSystemType type); 125 FileSystemType type);
114 126
127 void CollectOpenFileSystemMetrics(base::PlatformFileError error_code);
128
115 base::SequencedTaskRunner* file_task_runner() { 129 base::SequencedTaskRunner* file_task_runner() {
116 return file_task_runner_.get(); 130 return file_task_runner_.get();
117 } 131 }
118 132
119 AsyncFileUtilAdapter* file_util() { return sandbox_file_util_.get(); } 133 AsyncFileUtilAdapter* file_util() { return sandbox_file_util_.get(); }
120 FileSystemUsageCache* usage_cache() { return file_system_usage_cache_.get(); } 134 FileSystemUsageCache* usage_cache() { return file_system_usage_cache_.get(); }
121 SandboxQuotaObserver* quota_observer() { return quota_observer_.get(); }; 135 SandboxQuotaObserver* quota_observer() { return quota_observer_.get(); };
122 136
123 quota::SpecialStoragePolicy* special_storage_policy() { 137 quota::SpecialStoragePolicy* special_storage_policy() {
124 return special_storage_policy_.get(); 138 return special_storage_policy_.get();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 170
157 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_; 171 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
158 172
159 FileSystemOptions file_system_options_; 173 FileSystemOptions file_system_options_;
160 174
161 // Acccessed only on the file thread. 175 // Acccessed only on the file thread.
162 std::set<GURL> visited_origins_; 176 std::set<GURL> visited_origins_;
163 177
164 std::set<std::pair<GURL, FileSystemType> > sticky_dirty_origins_; 178 std::set<std::pair<GURL, FileSystemType> > sticky_dirty_origins_;
165 179
180 base::Time next_release_time_for_open_filesystem_stat_;
181
182 base::WeakPtrFactory<SandboxContext> weak_factory_;
183
166 DISALLOW_COPY_AND_ASSIGN(SandboxContext); 184 DISALLOW_COPY_AND_ASSIGN(SandboxContext);
167 }; 185 };
168 186
169 } // namespace fileapi 187 } // namespace fileapi
170 188
171 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_CONTEXT_H_ 189 #endif // WEBKIT_BROWSER_FILEAPI_SANDBOX_CONTEXT_H_
OLDNEW
« no previous file with comments | « no previous file | webkit/browser/fileapi/sandbox_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698