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

Unified Diff: webkit/browser/fileapi/isolated_context.cc

Issue 341043008: Add FileSystemID parameter to IsolatedContext::RegisterFileSystemForPath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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
« no previous file with comments | « webkit/browser/fileapi/isolated_context.h ('k') | webkit/browser/fileapi/mount_points.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/browser/fileapi/isolated_context.cc
diff --git a/webkit/browser/fileapi/isolated_context.cc b/webkit/browser/fileapi/isolated_context.cc
index f126330a2e21db66824cae7d1b85fd7419686512..a187a05e0cd9895c5ee15145a38c36248788f51b 100644
--- a/webkit/browser/fileapi/isolated_context.cc
+++ b/webkit/browser/fileapi/isolated_context.cc
@@ -106,7 +106,9 @@ class IsolatedContext::Instance {
// IsolatedContext::RegisterFileSystemForPath() or
// IsolatedContext::RegisterFileSystemForVirtualPath().
// Most of isolated file system contexts should be of this type.
- Instance(FileSystemType type, const MountPointInfo& file_info,
+ Instance(FileSystemType type,
+ const std::string& filesystem_id,
+ const MountPointInfo& file_info,
PathType path_type);
// For a multi-paths isolated file system. As of writing only file system
@@ -117,6 +119,7 @@ class IsolatedContext::Instance {
~Instance();
FileSystemType type() const { return type_; }
+ const std::string& filesystem_id() const { return filesystem_id_; }
const MountPointInfo& file_info() const { return file_info_; }
const std::set<MountPointInfo>& files() const { return files_; }
int ref_counts() const { return ref_counts_; }
@@ -131,6 +134,7 @@ class IsolatedContext::Instance {
private:
const FileSystemType type_;
+ const std::string filesystem_id_;
// For single-path instance.
const MountPointInfo file_info_;
@@ -147,9 +151,11 @@ class IsolatedContext::Instance {
};
IsolatedContext::Instance::Instance(FileSystemType type,
+ const std::string& filesystem_id,
const MountPointInfo& file_info,
Instance::PathType path_type)
: type_(type),
+ filesystem_id_(filesystem_id),
file_info_(file_info),
path_type_(path_type),
ref_counts_(0) {
@@ -218,6 +224,7 @@ std::string IsolatedContext::RegisterDraggedFileSystem(
std::string IsolatedContext::RegisterFileSystemForPath(
FileSystemType type,
+ const std::string& filesystem_id,
const base::FilePath& path_in,
std::string* register_name) {
base::FilePath path(path_in.NormalizePathSeparators());
@@ -233,11 +240,12 @@ std::string IsolatedContext::RegisterFileSystemForPath(
}
base::AutoLock locker(lock_);
- std::string filesystem_id = GetNewFileSystemId();
- instance_map_[filesystem_id] = new Instance(type, MountPointInfo(name, path),
- Instance::PLATFORM_PATH);
- path_to_id_map_[path].insert(filesystem_id);
- return filesystem_id;
+ std::string new_id = GetNewFileSystemId();
+ instance_map_[new_id] = new Instance(type, filesystem_id,
+ MountPointInfo(name, path),
+ Instance::PLATFORM_PATH);
+ path_to_id_map_[path].insert(new_id);
+ return new_id;
}
std::string IsolatedContext::RegisterFileSystemForVirtualPath(
@@ -251,6 +259,7 @@ std::string IsolatedContext::RegisterFileSystemForVirtualPath(
std::string filesystem_id = GetNewFileSystemId();
instance_map_[filesystem_id] = new Instance(
type,
+ std::string(), // filesystem_id
MountPointInfo(register_name, cracked_path_prefix),
Instance::VIRTUAL_PATH);
path_to_id_map_[path].insert(filesystem_id);
@@ -281,6 +290,7 @@ bool IsolatedContext::CrackVirtualPath(
const base::FilePath& virtual_path,
std::string* id_or_name,
FileSystemType* type,
+ std::string* cracked_id,
base::FilePath* path,
FileSystemMountOption* mount_option) const {
DCHECK(id_or_name);
@@ -314,6 +324,8 @@ bool IsolatedContext::CrackVirtualPath(
const Instance* instance = found_instance->second;
if (type)
*type = instance->type();
+ if (cracked_id)
+ *cracked_id = instance->filesystem_id();
if (component_iter == components.end()) {
// The virtual root case.
@@ -420,18 +432,22 @@ FileSystemURL IsolatedContext::CrackFileSystemURL(
return FileSystemURL();
std::string mount_name;
+ std::string cracked_mount_name;
FileSystemType cracked_type;
base::FilePath cracked_path;
FileSystemMountOption cracked_mount_option;
if (!CrackVirtualPath(url.path(), &mount_name, &cracked_type,
- &cracked_path, &cracked_mount_option)) {
+ &cracked_mount_name, &cracked_path,
+ &cracked_mount_option)) {
return FileSystemURL();
}
return FileSystemURL(
url.origin(), url.mount_type(), url.virtual_path(),
!url.filesystem_id().empty() ? url.filesystem_id() : mount_name,
- cracked_type, cracked_path, mount_name, cracked_mount_option);
+ cracked_type, cracked_path,
+ cracked_mount_name.empty() ? mount_name : cracked_mount_name,
+ cracked_mount_option);
}
bool IsolatedContext::UnregisterFileSystem(const std::string& filesystem_id) {
« no previous file with comments | « webkit/browser/fileapi/isolated_context.h ('k') | webkit/browser/fileapi/mount_points.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698