diff options
author | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 07:14:58 +0000 |
---|---|---|
committer | kinuko@chromium.org <kinuko@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-23 07:14:58 +0000 |
commit | 228945256c3d5b9709eb936ce420aa9f7c46f354 (patch) | |
tree | 96f08a9036fc05860bf0a765f4be193c5617f4cc /webkit | |
parent | d3ec669b62912a5464e1c89fde7218d06e4a5522 (diff) | |
download | chromium_src-228945256c3d5b9709eb936ce420aa9f7c46f354.zip chromium_src-228945256c3d5b9709eb936ce420aa9f7c46f354.tar.gz chromium_src-228945256c3d5b9709eb936ce420aa9f7c46f354.tar.bz2 |
Always pass FileSystemContext to ObfuscatedFileUtil operations
Now it may always refer operation_context->file_system_context() as it tries to invalidate the usage cache whenever it finds inconsistency.
BUG=129303
TEST=none
Review URL: https://chromiumcodereview.appspot.com/10407115
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138444 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/fileapi/file_system_context.cc | 6 | ||||
-rw-r--r-- | webkit/fileapi/file_system_quota_client.cc | 3 | ||||
-rw-r--r-- | webkit/fileapi/file_system_quota_util.h | 8 | ||||
-rw-r--r-- | webkit/fileapi/file_system_test_helper.cc | 2 | ||||
-rw-r--r-- | webkit/fileapi/sandbox_mount_point_provider.cc | 13 | ||||
-rw-r--r-- | webkit/fileapi/sandbox_mount_point_provider.h | 2 | ||||
-rw-r--r-- | webkit/fileapi/sandbox_mount_point_provider_unittest.cc | 5 | ||||
-rw-r--r-- | webkit/fileapi/test_mount_point_provider.cc | 1 |
8 files changed, 27 insertions, 13 deletions
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc index 4c25deb..3127af4 100644 --- a/webkit/fileapi/file_system_context.cc +++ b/webkit/fileapi/file_system_context.cc @@ -78,9 +78,9 @@ bool FileSystemContext::DeleteDataForOriginOnFileThread( // Delete temporary and persistent data. return sandbox_provider()->DeleteOriginDataOnFileThread( - quota_manager_proxy(), origin_url, kFileSystemTypeTemporary) && + this, quota_manager_proxy(), origin_url, kFileSystemTypeTemporary) && sandbox_provider()->DeleteOriginDataOnFileThread( - quota_manager_proxy(), origin_url, kFileSystemTypePersistent); + this, quota_manager_proxy(), origin_url, kFileSystemTypePersistent); } bool FileSystemContext::DeleteDataForOriginAndTypeOnFileThread( @@ -90,7 +90,7 @@ bool FileSystemContext::DeleteDataForOriginAndTypeOnFileThread( type == fileapi::kFileSystemTypePersistent) { DCHECK(sandbox_provider()); return sandbox_provider()->DeleteOriginDataOnFileThread( - quota_manager_proxy(), origin_url, type); + this, quota_manager_proxy(), origin_url, type); } return false; } diff --git a/webkit/fileapi/file_system_quota_client.cc b/webkit/fileapi/file_system_quota_client.cc index f4ee095..9619ecc 100644 --- a/webkit/fileapi/file_system_quota_client.cc +++ b/webkit/fileapi/file_system_quota_client.cc @@ -47,7 +47,8 @@ class FileSystemQuotaClient::GetOriginUsageTask : public QuotaThreadTask { virtual void RunOnTargetThread() OVERRIDE { FileSystemQuotaUtil* quota_util = file_system_context_->GetQuotaUtil(type_); if (quota_util) - fs_usage_ = quota_util->GetOriginUsageOnFileThread(origin_url_, type_); + fs_usage_ = quota_util->GetOriginUsageOnFileThread( + file_system_context_, origin_url_, type_); } virtual void Completed() OVERRIDE { diff --git a/webkit/fileapi/file_system_quota_util.h b/webkit/fileapi/file_system_quota_util.h index 9640e93..66e8e33 100644 --- a/webkit/fileapi/file_system_quota_util.h +++ b/webkit/fileapi/file_system_quota_util.h @@ -23,6 +23,8 @@ class QuotaManagerProxy; namespace fileapi { +class FileSystemContext; + // An abstract interface that provides common quota-related utility functions // for internal filesystem modules. The main consumer of this class is // file_system_quota_client and quota_file_util. @@ -67,8 +69,10 @@ class FileSystemQuotaUtil { // Called by quota client. // Returns the amount of data used for the origin for usage tracking. - virtual int64 GetOriginUsageOnFileThread(const GURL& origin_url, - fileapi::FileSystemType type) = 0; + virtual int64 GetOriginUsageOnFileThread( + fileapi::FileSystemContext* file_system_context, + const GURL& origin_url, + fileapi::FileSystemType type) = 0; // Called by quota file util. virtual void UpdateOriginUsageOnFileThread(quota::QuotaManagerProxy* proxy, diff --git a/webkit/fileapi/file_system_test_helper.cc b/webkit/fileapi/file_system_test_helper.cc index e8743e4..7c26ee7 100644 --- a/webkit/fileapi/file_system_test_helper.cc +++ b/webkit/fileapi/file_system_test_helper.cc @@ -159,7 +159,7 @@ base::PlatformFileError FileSystemTestOriginHelper::SameFileUtilMove( int64 FileSystemTestOriginHelper::GetCachedOriginUsage() const { return file_system_context_->GetQuotaUtil(type_)->GetOriginUsageOnFileThread( - origin_, type_); + file_system_context_, origin_, type_); } int64 FileSystemTestOriginHelper::ComputeCurrentOriginUsage() const { diff --git a/webkit/fileapi/sandbox_mount_point_provider.cc b/webkit/fileapi/sandbox_mount_point_provider.cc index 74dc0ca..1c5fa78 100644 --- a/webkit/fileapi/sandbox_mount_point_provider.cc +++ b/webkit/fileapi/sandbox_mount_point_provider.cc @@ -498,11 +498,14 @@ FilePath SandboxMountPointProvider::GetBaseDirectoryForOriginAndType( } bool SandboxMountPointProvider::DeleteOriginDataOnFileThread( - QuotaManagerProxy* proxy, const GURL& origin_url, + FileSystemContext* file_system_context, + QuotaManagerProxy* proxy, + const GURL& origin_url, fileapi::FileSystemType type) { MigrateIfNeeded(sandbox_file_util_, old_base_path()); - int64 usage = GetOriginUsageOnFileThread(origin_url, type); + int64 usage = GetOriginUsageOnFileThread(file_system_context, + origin_url, type); bool result = sandbox_file_util_->DeleteDirectoryForOriginAndType(origin_url, type); @@ -552,7 +555,9 @@ void SandboxMountPointProvider::GetOriginsForHostOnFileThread( } int64 SandboxMountPointProvider::GetOriginUsageOnFileThread( - const GURL& origin_url, fileapi::FileSystemType type) { + FileSystemContext* file_system_context, + const GURL& origin_url, + fileapi::FileSystemType type) { DCHECK(type == kFileSystemTypeTemporary || type == kFileSystemTypePersistent); FilePath base_path = @@ -574,7 +579,7 @@ int64 SandboxMountPointProvider::GetOriginUsageOnFileThread( // Get the directory size now and update the cache. FileSystemUsageCache::Delete(usage_file_path); - FileSystemOperationContext context(NULL); + FileSystemOperationContext context(file_system_context); FileSystemPath path(origin_url, type, FilePath()); scoped_ptr<FileSystemFileUtil::AbstractFileEnumerator> enumerator( sandbox_file_util_->CreateFileEnumerator(&context, path, true)); diff --git a/webkit/fileapi/sandbox_mount_point_provider.h b/webkit/fileapi/sandbox_mount_point_provider.h index 1219f95..f0b1fd6 100644 --- a/webkit/fileapi/sandbox_mount_point_provider.h +++ b/webkit/fileapi/sandbox_mount_point_provider.h @@ -128,6 +128,7 @@ class SandboxMountPointProvider // Deletes the data on the origin and reports the amount of deleted data // to the quota manager via |proxy|. bool DeleteOriginDataOnFileThread( + FileSystemContext* context, quota::QuotaManagerProxy* proxy, const GURL& origin_url, FileSystemType type); @@ -141,6 +142,7 @@ class SandboxMountPointProvider const std::string& host, std::set<GURL>* origins) OVERRIDE; virtual int64 GetOriginUsageOnFileThread( + FileSystemContext* context, const GURL& origin_url, FileSystemType type) OVERRIDE; virtual void NotifyOriginWasAccessedOnIOThread( diff --git a/webkit/fileapi/sandbox_mount_point_provider_unittest.cc b/webkit/fileapi/sandbox_mount_point_provider_unittest.cc index ac86d37..8f59dd1 100644 --- a/webkit/fileapi/sandbox_mount_point_provider_unittest.cc +++ b/webkit/fileapi/sandbox_mount_point_provider_unittest.cc @@ -294,7 +294,7 @@ class SandboxMountPointProviderMigrationTest : public testing::Test { break; case 3: sandbox_provider()->DeleteOriginDataOnFileThread( - NULL, origin_url, type); + file_system_context_, NULL, origin_url, type); break; case 4: sandbox_provider()->GetOriginsForTypeOnFileThread( @@ -305,7 +305,8 @@ class SandboxMountPointProviderMigrationTest : public testing::Test { type, host, &origins); break; case 6: - sandbox_provider()->GetOriginUsageOnFileThread(origin_url, type); + sandbox_provider()->GetOriginUsageOnFileThread( + file_system_context_, origin_url, type); break; case 7: // This case has to use an origin that already exists in the diff --git a/webkit/fileapi/test_mount_point_provider.cc b/webkit/fileapi/test_mount_point_provider.cc index da2b5df..446359f 100644 --- a/webkit/fileapi/test_mount_point_provider.cc +++ b/webkit/fileapi/test_mount_point_provider.cc @@ -41,6 +41,7 @@ class TestFileSystemQuotaUtil : public FileSystemQuotaUtil { NOTREACHED(); } virtual int64 GetOriginUsageOnFileThread( + FileSystemContext* context, const GURL& origin_url, FileSystemType type) OVERRIDE { return usage_; |