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

Side by Side Diff: webkit/fileapi/file_system_context.h

Issue 9004019: Cleanup: Removing FileSystemPathManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix Created 9 years 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "webkit/fileapi/file_system_types.h" 10 #include "webkit/fileapi/file_system_types.h"
11 #include "webkit/quota/special_storage_policy.h" 11 #include "webkit/quota/special_storage_policy.h"
12 12
13 class FilePath; 13 class FilePath;
14 class GURL; 14 class GURL;
15 15
16 namespace base { 16 namespace base {
17 class MessageLoopProxy; 17 class MessageLoopProxy;
18 } 18 }
19 19
20 namespace quota { 20 namespace quota {
21 class QuotaManagerProxy; 21 class QuotaManagerProxy;
22 } 22 }
23 23
24 namespace fileapi { 24 namespace fileapi {
25 25
26 class ExternalFileSystemMountPointProvider;
26 class FileSystemContext; 27 class FileSystemContext;
28 class FileSystemFileUtil;
29 class FileSystemMountPointProvider;
30 class FileSystemOptions;
27 class FileSystemPathManager; 31 class FileSystemPathManager;
28 class FileSystemQuotaUtil; 32 class FileSystemQuotaUtil;
29 class SandboxMountPointProvider; 33 class SandboxMountPointProvider;
30 34
31 struct DefaultContextDeleter; 35 struct DefaultContextDeleter;
32 36
33 // This class keeps and provides a file system context for FileSystem API. 37 // This class keeps and provides a file system context for FileSystem API.
34 // An instance of this class is created and owned by profile. 38 // An instance of this class is created and owned by profile.
35 class FileSystemContext 39 class FileSystemContext
36 : public base::RefCountedThreadSafe<FileSystemContext, 40 : public base::RefCountedThreadSafe<FileSystemContext,
37 DefaultContextDeleter> { 41 DefaultContextDeleter> {
38 public: 42 public:
43 // The ownership of |options| is transferred from the caller.
ericu 2011/12/20 18:12:59 It's a very small class. Perhaps we should just p
kinuko 2011/12/21 13:00:50 The point is I used virtual methods for allowing b
ericu 2011/12/21 22:22:48 I meant that the class, with its virtual methods,
kinuko 2011/12/22 05:28:39 Sorry I might be missing something but I cannot im
kinuko 2011/12/27 17:33:27 Ok I stopped using virtual methods and converted t
39 FileSystemContext( 44 FileSystemContext(
40 scoped_refptr<base::MessageLoopProxy> file_message_loop, 45 base::MessageLoopProxy* file_message_loop,
41 scoped_refptr<base::MessageLoopProxy> io_message_loop, 46 base::MessageLoopProxy* io_message_loop,
42 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy, 47 quota::SpecialStoragePolicy* special_storage_policy,
ericu 2011/12/20 18:12:59 Why are these no longer scoped_refptrs? Should th
kinuko 2011/12/21 13:00:50 They are all cast'ed to scoped_refptr in the initi
ericu 2011/12/21 22:22:48 Making the code look simpler than it is may cause
kinuko 2011/12/22 05:28:39 Another subtle benefit is we can save refcount chu
kinuko 2011/12/27 17:33:27 I reverted these changes for now. We can change t
43 quota::QuotaManagerProxy* quota_manager_proxy, 48 quota::QuotaManagerProxy* quota_manager_proxy,
44 const FilePath& profile_path, 49 const FilePath& profile_path,
45 bool is_incognito, 50 FileSystemOptions* options);
46 bool allow_file_access_from_files,
47 FileSystemPathManager* path_manager);
48 ~FileSystemContext(); 51 ~FileSystemContext();
49 52
50 // This method can be called on any thread. 53 // This method can be called on any thread.
51 bool DeleteDataForOriginOnFileThread(const GURL& origin_url); 54 bool DeleteDataForOriginOnFileThread(const GURL& origin_url);
52 bool DeleteDataForOriginAndTypeOnFileThread(const GURL& origin_url, 55 bool DeleteDataForOriginAndTypeOnFileThread(const GURL& origin_url,
53 FileSystemType type); 56 FileSystemType type);
54 57
55 FileSystemPathManager* path_manager() const { return path_manager_.get(); }
56 quota::QuotaManagerProxy* quota_manager_proxy() const { 58 quota::QuotaManagerProxy* quota_manager_proxy() const {
57 return quota_manager_proxy_.get(); 59 return quota_manager_proxy_.get();
58 } 60 }
59 61
60 // Returns a quota util for a given filesystem type. This may 62 // Returns a quota util for a given filesystem type. This may
61 // return NULL if the type does not support the usage tracking or 63 // return NULL if the type does not support the usage tracking or
62 // it is not a quota-managed storage. 64 // it is not a quota-managed storage.
63 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const; 65 FileSystemQuotaUtil* GetQuotaUtil(FileSystemType type) const;
64 66
67 // Returns the appropriate FileUtil instance for the given |type|.
68 // This may return NULL if it is given an invalid or unsupported filesystem
69 // type.
70 FileSystemFileUtil* GetFileUtil(FileSystemType type) const;
71
72 // Returns the mount point provider instance for the given |type|.
73 // This may return NULL if it is given an invalid or unsupported filesystem
74 // type.
75 FileSystemMountPointProvider* GetMountPointProvider(
76 FileSystemType type) const;
77
78 // Returns a FileSystemMountPointProvider instance for sandboxed filesystem
79 // types (e.g. TEMPORARY or PERSISTENT). This is equivalent to calling
80 // GetMountPointProvider(kFileSystemType{Temporary, Persistent}).
81 SandboxMountPointProvider* sandbox_provider() const;
82
83 // Returns a FileSystemMountPointProvider instance for external filesystem
84 // type, which is used only by chromeos for now. This is equivalent to
85 // calling GetMountPointProvider(kFileSystemTypeExternal).
86 ExternalFileSystemMountPointProvider* external_provider() const;
87
65 private: 88 private:
66 friend struct DefaultContextDeleter; 89 friend struct DefaultContextDeleter;
67 void DeleteOnCorrectThread() const; 90 void DeleteOnCorrectThread() const;
68 SandboxMountPointProvider* sandbox_provider() const;
69 91
70 scoped_refptr<base::MessageLoopProxy> file_message_loop_; 92 scoped_refptr<base::MessageLoopProxy> file_message_loop_;
71 scoped_refptr<base::MessageLoopProxy> io_message_loop_; 93 scoped_refptr<base::MessageLoopProxy> io_message_loop_;
72 94
73 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_; 95 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
74 96
75 scoped_ptr<FileSystemPathManager> path_manager_; 97 // Mount point providers.
98 scoped_ptr<SandboxMountPointProvider> sandbox_provider_;
99 scoped_ptr<ExternalFileSystemMountPointProvider> external_provider_;
76 100
77 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext); 101 DISALLOW_IMPLICIT_CONSTRUCTORS(FileSystemContext);
78 }; 102 };
79 103
80 struct DefaultContextDeleter { 104 struct DefaultContextDeleter {
81 static void Destruct(const FileSystemContext* context) { 105 static void Destruct(const FileSystemContext* context) {
82 context->DeleteOnCorrectThread(); 106 context->DeleteOnCorrectThread();
83 } 107 }
84 }; 108 };
85 109
86 } // namespace fileapi 110 } // namespace fileapi
87 111
88 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_ 112 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698