diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 15:16:48 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-18 15:16:48 +0000 |
commit | 2a030eef67d564234a96d374f11d337db94e5cc8 (patch) | |
tree | 679c7bcb9c34cff9d4252304fb9e0cd39394d59a /webkit | |
parent | 9b17e24f9ea91192a9f9efc584468c1887e8c335 (diff) | |
download | chromium_src-2a030eef67d564234a96d374f11d337db94e5cc8.zip chromium_src-2a030eef67d564234a96d374f11d337db94e5cc8.tar.gz chromium_src-2a030eef67d564234a96d374f11d337db94e5cc8.tar.bz2 |
Don't assume sandbox_provider() handles all sandboxed filesystems
- Moves DeleteOriginDataOnFileThread() method to
QuotaUtil interface (from SandboxMountPointProvider)
- Changes FileSystemContext::DeleteDataForOriginOnFileThread
not to directly call sandbox_provider()->DeleteOriginDataOnFileThread
but calls the QuotaUtil's DeleteOriginDataOnFileThread method
if the provider returns non-null QuotaUtil.
More changes are coming, this is fixing the easiest part.
BUG=250791
TEST=unit_test:BrowsingDataFileSystemHelperTest.*
Review URL: https://chromiumcodereview.appspot.com/17083003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@206997 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/browser/fileapi/file_system_context.cc | 31 | ||||
-rw-r--r-- | webkit/browser/fileapi/file_system_context.h | 5 | ||||
-rw-r--r-- | webkit/browser/fileapi/file_system_quota_util.h | 9 | ||||
-rw-r--r-- | webkit/browser/fileapi/sandbox_mount_point_provider.h | 9 | ||||
-rw-r--r-- | webkit/browser/fileapi/test_mount_point_provider.cc | 8 |
5 files changed, 40 insertions, 22 deletions
diff --git a/webkit/browser/fileapi/file_system_context.cc b/webkit/browser/fileapi/file_system_context.cc index 4d0e89f..e1e99ed 100644 --- a/webkit/browser/fileapi/file_system_context.cc +++ b/webkit/browser/fileapi/file_system_context.cc @@ -119,23 +119,24 @@ FileSystemContext::FileSystemContext( bool FileSystemContext::DeleteDataForOriginOnFileThread( const GURL& origin_url) { DCHECK(task_runners_->file_task_runner()->RunsTasksOnCurrentThread()); - DCHECK(sandbox_provider()); DCHECK(origin_url == origin_url.GetOrigin()); - // Delete temporary and persistent data. - return - (sandbox_provider()->DeleteOriginDataOnFileThread( - this, quota_manager_proxy(), origin_url, - kFileSystemTypeTemporary) == - base::PLATFORM_FILE_OK) && - (sandbox_provider()->DeleteOriginDataOnFileThread( - this, quota_manager_proxy(), origin_url, - kFileSystemTypePersistent) == - base::PLATFORM_FILE_OK) && - (sandbox_provider()->DeleteOriginDataOnFileThread( - this, quota_manager_proxy(), origin_url, - kFileSystemTypeSyncable) == - base::PLATFORM_FILE_OK); + bool success = true; + for (MountPointProviderMap::iterator iter = provider_map_.begin(); + iter != provider_map_.end(); + ++iter) { + FileSystemMountPointProvider* provider = iter->second; + if (!provider->GetQuotaUtil()) + continue; + if (provider->GetQuotaUtil()->DeleteOriginDataOnFileThread( + this, quota_manager_proxy(), origin_url, iter->first) + != base::PLATFORM_FILE_OK) { + // Continue the loop, but record the failure. + success = false; + } + } + + return success; } FileSystemQuotaUtil* diff --git a/webkit/browser/fileapi/file_system_context.h b/webkit/browser/fileapi/file_system_context.h index a35acee5..ce8648d 100644 --- a/webkit/browser/fileapi/file_system_context.h +++ b/webkit/browser/fileapi/file_system_context.h @@ -284,8 +284,11 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemContext // Registered mount point providers. // The map must be constructed in the constructor since it can be accessed // on multiple threads. - // The ownership of each provider is held by mount_point_providers_. + // This map itself doesn't retain each provider's ownership; ownerships + // of the providers are held by additional_providers_ or other scoped_ptr + // provider fields. MountPointProviderMap provider_map_; + // External mount points visible in the file system context (excluding system // external mount points). scoped_refptr<ExternalMountPoints> external_mount_points_; diff --git a/webkit/browser/fileapi/file_system_quota_util.h b/webkit/browser/fileapi/file_system_quota_util.h index 64776e3..4369db7 100644 --- a/webkit/browser/fileapi/file_system_quota_util.h +++ b/webkit/browser/fileapi/file_system_quota_util.h @@ -9,6 +9,7 @@ #include <string> #include "base/basictypes.h" +#include "base/platform_file.h" #include "googleurl/src/gurl.h" #include "webkit/browser/webkit_storage_browser_export.h" #include "webkit/common/fileapi/file_system_types.h" @@ -33,6 +34,14 @@ class WEBKIT_STORAGE_BROWSER_EXPORT FileSystemQuotaUtil { public: virtual ~FileSystemQuotaUtil() {} + // Deletes the data on the origin and reports the amount of deleted data + // to the quota manager via |proxy|. + virtual base::PlatformFileError DeleteOriginDataOnFileThread( + FileSystemContext* context, + quota::QuotaManagerProxy* proxy, + const GURL& origin_url, + FileSystemType type) = 0; + virtual void GetOriginsForTypeOnFileThread(fileapi::FileSystemType type, std::set<GURL>* origins) = 0; diff --git a/webkit/browser/fileapi/sandbox_mount_point_provider.h b/webkit/browser/fileapi/sandbox_mount_point_provider.h index f3e195c..cb0d70b 100644 --- a/webkit/browser/fileapi/sandbox_mount_point_provider.h +++ b/webkit/browser/fileapi/sandbox_mount_point_provider.h @@ -131,15 +131,12 @@ class WEBKIT_STORAGE_BROWSER_EXPORT SandboxMountPointProvider FileSystemType type, bool create); - // Deletes the data on the origin and reports the amount of deleted data - // to the quota manager via |proxy|. - base::PlatformFileError DeleteOriginDataOnFileThread( + // FileSystemQuotaUtil overrides. + virtual base::PlatformFileError DeleteOriginDataOnFileThread( FileSystemContext* context, quota::QuotaManagerProxy* proxy, const GURL& origin_url, - FileSystemType type); - - // FileSystemQuotaUtil overrides. + FileSystemType type) OVERRIDE; virtual void GetOriginsForTypeOnFileThread( FileSystemType type, std::set<GURL>* origins) OVERRIDE; diff --git a/webkit/browser/fileapi/test_mount_point_provider.cc b/webkit/browser/fileapi/test_mount_point_provider.cc index 14211f2..fe05ceb 100644 --- a/webkit/browser/fileapi/test_mount_point_provider.cc +++ b/webkit/browser/fileapi/test_mount_point_provider.cc @@ -33,6 +33,14 @@ class TestMountPointProvider::QuotaUtil virtual ~QuotaUtil() {} // FileSystemQuotaUtil overrides. + virtual base::PlatformFileError DeleteOriginDataOnFileThread( + FileSystemContext* context, + quota::QuotaManagerProxy* proxy, + const GURL& origin_url, + FileSystemType type) OVERRIDE { + NOTREACHED(); + return base::PLATFORM_FILE_OK; + } virtual void GetOriginsForTypeOnFileThread( FileSystemType type, std::set<GURL>* origins) OVERRIDE { |