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

Unified Diff: webkit/chromeos/fileapi/cros_mount_point_provider.h

Issue 11648027: Extract external file systems handling from isolated context. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: gypi file Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: webkit/chromeos/fileapi/cros_mount_point_provider.h
diff --git a/webkit/chromeos/fileapi/cros_mount_point_provider.h b/webkit/chromeos/fileapi/cros_mount_point_provider.h
index 6f7b38bbcdb6c3e99a019c31ddb6081d9887d0c4..d34c2093b091f5c4d3f5f12280e1261e1a5227e3 100644
--- a/webkit/chromeos/fileapi/cros_mount_point_provider.h
+++ b/webkit/chromeos/fileapi/cros_mount_point_provider.h
@@ -18,6 +18,7 @@
#include "webkit/storage/webkit_storage_export.h"
namespace fileapi {
+class ExternalMountPoints;
class FileSystemFileUtil;
class FileSystemURL;
class IsolatedContext;
@@ -35,8 +36,13 @@ class WEBKIT_STORAGE_EXPORT CrosMountPointProvider
using fileapi::FileSystemMountPointProvider::ValidateFileSystemCallback;
using fileapi::FileSystemMountPointProvider::DeleteFileSystemCallback;
+ // CrosMountPointProvider will take an ownership of a |mount_points|
+ // reference. On the other hand, |system_mount_points| will be kept as a raw
+ // pointer and it should outlive CrosMountPointProvider instance.
CrosMountPointProvider(
- scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy);
+ scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy,
+ scoped_refptr<fileapi::ExternalMountPoints> mount_points,
+ fileapi::ExternalMountPoints* system_mount_points);
virtual ~CrosMountPointProvider();
// Returns true if CrosMountpointProvider can handle |url|, i.e. its
@@ -88,11 +94,14 @@ class WEBKIT_STORAGE_EXPORT CrosMountPointProvider
const std::string& extension_id, const FilePath& virtual_path) OVERRIDE;
virtual void RevokeAccessForExtension(
const std::string& extension_id) OVERRIDE;
- virtual bool HasMountPoint(const FilePath& mount_point) OVERRIDE;
- virtual void AddLocalMountPoint(const FilePath& mount_point) OVERRIDE;
- virtual void AddRestrictedLocalMountPoint(
+ // Note: This will ignore |system_mount_points_|. The reasoning behind this is
+ // the method should be used paired with Add/RemoveMountPoint methods, which
+ // don't affect |system_mount_points_|.
+ virtual bool HasMountPoint(const FilePath& mount_point) const OVERRIDE;
+ virtual bool AddLocalMountPoint(const FilePath& mount_point) OVERRIDE;
+ virtual bool AddRestrictedLocalMountPoint(
const FilePath& mount_point) OVERRIDE;
- virtual void AddRemoteMountPoint(
+ virtual bool AddRemoteMountPoint(
const FilePath& mount_point,
fileapi::RemoteFileSystemProxyInterface* remote_proxy) OVERRIDE;
virtual void RemoveMountPoint(const FilePath& mount_point) OVERRIDE;
@@ -100,22 +109,31 @@ class WEBKIT_STORAGE_EXPORT CrosMountPointProvider
FilePath* virtual_path) OVERRIDE;
private:
- typedef scoped_refptr<fileapi::RemoteFileSystemProxyInterface> RemoteProxy;
- typedef std::map<FilePath::StringType, RemoteProxy> RemoteProxyMap;
-
- fileapi::IsolatedContext* isolated_context() const;
-
- // Represents a map from mount point name to a remote proxy.
- RemoteProxyMap remote_proxy_map_;
-
- // Reverse map for GetVirtualPath.
- std::map<FilePath, FilePath> local_to_virtual_map_;
-
- mutable base::Lock mount_point_map_lock_;
+ fileapi::RemoteFileSystemProxyInterface* GetRemoteProxy(
+ const std::string& mount_name) const;
scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy_;
scoped_ptr<FileAccessPermissions> file_access_permissions_;
scoped_ptr<fileapi::LocalFileUtil> local_file_util_;
+
+ // Mount points specific to the owning context.
+ //
+ // Add/Remove MountPoints will affect only these mount points.
+ //
+ // It is legal to have mount points with the same name as in
+ // system_mount_points_. Also, mount point paths may overlap with mount point
+ // paths in system_mount_points_. In both cases mount points in
+ // |mount_points_| will have a priority.
+ // E.g. if |mount_points_| map 'foo1' to '/foo/foo1' and
+ // |file_system_mount_points_| map 'xxx' to '/foo/foo1/xxx', |GetVirtualPaths|
+ // will resolve '/foo/foo1/xxx/yyy' as 'foo1/xxx/yyy' (i.e. the mapping from
+ // |mount_points_| will be used).
+ scoped_refptr<fileapi::ExternalMountPoints> mount_points_;
+
+ // Globally visible mount points. System MountPonts instance should outlive
+ // all CrosMountPointProvider instances, so raw pointer is safe.
+ fileapi::ExternalMountPoints* system_mount_points_;
+
DISALLOW_COPY_AND_ASSIGN(CrosMountPointProvider);
};

Powered by Google App Engine
This is Rietveld 408576698