diff options
Diffstat (limited to 'webkit/fileapi')
-rw-r--r-- | webkit/fileapi/file_system_context.cc | 21 | ||||
-rw-r--r-- | webkit/fileapi/file_system_context.h | 5 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation_unittest.cc | 14 | ||||
-rw-r--r-- | webkit/fileapi/file_system_operation_write_unittest.cc | 10 | ||||
-rw-r--r-- | webkit/fileapi/file_system_quota_client.cc | 17 | ||||
-rw-r--r-- | webkit/fileapi/file_writer_delegate.cc | 1 | ||||
-rw-r--r-- | webkit/fileapi/file_writer_delegate_unittest.cc | 8 | ||||
-rw-r--r-- | webkit/fileapi/obfuscated_file_util.cc | 8 | ||||
-rw-r--r-- | webkit/fileapi/obfuscated_file_util.h | 8 |
9 files changed, 60 insertions, 32 deletions
diff --git a/webkit/fileapi/file_system_context.cc b/webkit/fileapi/file_system_context.cc index e64f497..f0c596e 100644 --- a/webkit/fileapi/file_system_context.cc +++ b/webkit/fileapi/file_system_context.cc @@ -70,9 +70,6 @@ FileSystemContext::FileSystemContext( #endif } -FileSystemContext::~FileSystemContext() { -} - bool FileSystemContext::DeleteDataForOriginOnFileThread( const GURL& origin_url) { DCHECK(file_message_loop_->BelongsToCurrentThread()); @@ -144,14 +141,6 @@ FileSystemContext::external_provider() const { return external_provider_.get(); } -void FileSystemContext::DeleteOnCorrectThread() const { - if (!io_message_loop_->BelongsToCurrentThread() && - io_message_loop_->DeleteSoon(FROM_HERE, this)) { - return; - } - delete this; -} - void FileSystemContext::OpenFileSystem( const GURL& origin_url, FileSystemType type, @@ -206,4 +195,14 @@ webkit_blob::FileReader* FileSystemContext::CreateFileReader( return mount_point_provider->CreateFileReader(url, offset, file_proxy, this); } +FileSystemContext::~FileSystemContext() {} + +void FileSystemContext::DeleteOnCorrectThread() const { + if (!io_message_loop_->BelongsToCurrentThread() && + io_message_loop_->DeleteSoon(FROM_HERE, this)) { + return; + } + delete this; +} + } // namespace fileapi diff --git a/webkit/fileapi/file_system_context.h b/webkit/fileapi/file_system_context.h index d72a3ca..6c43037 100644 --- a/webkit/fileapi/file_system_context.h +++ b/webkit/fileapi/file_system_context.h @@ -11,6 +11,7 @@ #include "base/memory/ref_counted.h" #include "base/memory/scoped_ptr.h" #include "base/platform_file.h" +#include "base/sequenced_task_runner_helpers.h" #include "webkit/fileapi/file_system_types.h" #include "webkit/quota/special_storage_policy.h" @@ -56,7 +57,6 @@ class FileSystemContext quota::QuotaManagerProxy* quota_manager_proxy, const FilePath& profile_path, const FileSystemOptions& options); - ~FileSystemContext(); // This method can be called on any thread. bool DeleteDataForOriginOnFileThread(const GURL& origin_url); @@ -131,6 +131,9 @@ class FileSystemContext private: friend struct DefaultContextDeleter; + friend class base::DeleteHelper<FileSystemContext>; + ~FileSystemContext(); + void DeleteOnCorrectThread() const; scoped_refptr<base::MessageLoopProxy> file_message_loop_; diff --git a/webkit/fileapi/file_system_operation_unittest.cc b/webkit/fileapi/file_system_operation_unittest.cc index 20bf577..9eabd5e 100644 --- a/webkit/fileapi/file_system_operation_unittest.cc +++ b/webkit/fileapi/file_system_operation_unittest.cc @@ -62,8 +62,12 @@ class MockQuotaManager : public QuotaManager { callback.Run(quota::kQuotaStatusOk, usage_, quota_); } + protected: + virtual ~MockQuotaManager() {} + private: friend class MockQuotaManagerProxy; + void SetQuota(const GURL& origin, StorageType type, int64 quota) { EXPECT_EQ(origin_, origin); EXPECT_EQ(type_, type); @@ -97,10 +101,6 @@ class MockQuotaManagerProxy : public QuotaManagerProxy { registered_client_(NULL) { } - virtual ~MockQuotaManagerProxy() { - EXPECT_FALSE(registered_client_); - } - virtual void RegisterClient(QuotaClient* client) OVERRIDE { EXPECT_FALSE(registered_client_); registered_client_ = client; @@ -140,10 +140,16 @@ class MockQuotaManagerProxy : public QuotaManagerProxy { mock_manager()->SetQuota(origin, type, quota); } + protected: + virtual ~MockQuotaManagerProxy() { + EXPECT_FALSE(registered_client_); + } + private: MockQuotaManager* mock_manager() const { return static_cast<MockQuotaManager*>(quota_manager()); } + QuotaClient* registered_client_; }; diff --git a/webkit/fileapi/file_system_operation_write_unittest.cc b/webkit/fileapi/file_system_operation_write_unittest.cc index cf26cbc..5ba14c5 100644 --- a/webkit/fileapi/file_system_operation_write_unittest.cc +++ b/webkit/fileapi/file_system_operation_write_unittest.cc @@ -57,12 +57,15 @@ class MockQuotaManager : public QuotaManager { void set_usage(int64 usage) { usage_ = usage; } void set_quota(int64 quota) { quota_ = quota; } + protected: + virtual ~MockQuotaManager() {} + private: int64 usage_; int64 quota_; }; -} // namespace (anonymous) +} // namespace class FileSystemOperationWriteTest : public testing::Test, @@ -151,12 +154,13 @@ class TestURLRequestContext : public net::URLRequestContext { TestURLRequestContext() : blob_storage_controller_(new webkit_blob::BlobStorageController) {} - virtual ~TestURLRequestContext() {} - webkit_blob::BlobStorageController* blob_storage_controller() const { return blob_storage_controller_.get(); } + protected: + virtual ~TestURLRequestContext() {} + private: scoped_ptr<webkit_blob::BlobStorageController> blob_storage_controller_; }; diff --git a/webkit/fileapi/file_system_quota_client.cc b/webkit/fileapi/file_system_quota_client.cc index bb86fd9..d0a1ccc 100644 --- a/webkit/fileapi/file_system_quota_client.cc +++ b/webkit/fileapi/file_system_quota_client.cc @@ -41,9 +41,10 @@ class FileSystemQuotaClient::GetOriginUsageTask : public QuotaThreadTask { file_system_context_ = quota_client_->file_system_context_; } + protected: virtual ~GetOriginUsageTask() {} - protected: + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { FileSystemQuotaUtil* quota_util = file_system_context_->GetQuotaUtil(type_); if (quota_util) @@ -73,9 +74,11 @@ class FileSystemQuotaClient::GetOriginsForTypeTask : public QuotaThreadTask { DCHECK(quota_client_); file_system_context_ = quota_client_->file_system_context_; } - virtual ~GetOriginsForTypeTask() {} protected: + virtual ~GetOriginsForTypeTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { FileSystemQuotaUtil* quota_util = file_system_context_->GetQuotaUtil(type_); if (quota_util) @@ -107,9 +110,11 @@ class FileSystemQuotaClient::GetOriginsForHostTask : public QuotaThreadTask { DCHECK(quota_client_); file_system_context_ = quota_client_->file_system_context_; } - virtual ~GetOriginsForHostTask() {} protected: + virtual ~GetOriginsForHostTask() {} + + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { FileSystemQuotaUtil* quota_util = file_system_context_->GetQuotaUtil(type_); if (quota_util) @@ -145,8 +150,10 @@ class FileSystemQuotaClient::DeleteOriginTask callback_(callback) { } + protected: virtual ~DeleteOriginTask() {} + // QuotaThreadTask: virtual void RunOnTargetThread() OVERRIDE { if (file_system_context_->DeleteDataForOriginAndTypeOnFileThread( origin_, type_)) @@ -158,6 +165,7 @@ class FileSystemQuotaClient::DeleteOriginTask virtual void Completed() OVERRIDE { callback_.Run(status_); } + private: FileSystemContext* file_system_context_; GURL origin_; @@ -176,8 +184,7 @@ FileSystemQuotaClient::FileSystemQuotaClient( DCHECK(file_message_loop); } -FileSystemQuotaClient::~FileSystemQuotaClient() { -} +FileSystemQuotaClient::~FileSystemQuotaClient() {} quota::QuotaClient::ID FileSystemQuotaClient::id() const { return quota::QuotaClient::kFileSystem; diff --git a/webkit/fileapi/file_writer_delegate.cc b/webkit/fileapi/file_writer_delegate.cc index a5da1c6..d92684b 100644 --- a/webkit/fileapi/file_writer_delegate.cc +++ b/webkit/fileapi/file_writer_delegate.cc @@ -52,6 +52,7 @@ class InitializeTask : public base::RefCountedThreadSafe<InitializeTask> { private: friend class base::RefCountedThreadSafe<InitializeTask>; + ~InitializeTask() {} void RunCallback() { callback_.Run(error_code_, file_info_); diff --git a/webkit/fileapi/file_writer_delegate_unittest.cc b/webkit/fileapi/file_writer_delegate_unittest.cc index 82ac10b..24a85cb 100644 --- a/webkit/fileapi/file_writer_delegate_unittest.cc +++ b/webkit/fileapi/file_writer_delegate_unittest.cc @@ -158,8 +158,9 @@ class FileWriterDelegateTestJob : public net::URLRequestJob { base::Bind(&FileWriterDelegateTestJob::NotifyHeadersComplete, this)); } - virtual bool ReadRawData(net::IOBuffer* buf, int buf_size, int *bytes_read) - OVERRIDE { + virtual bool ReadRawData(net::IOBuffer* buf, + int buf_size, + int *bytes_read) OVERRIDE { if (remaining_bytes_ < buf_size) buf_size = static_cast<int>(remaining_bytes_); @@ -176,6 +177,9 @@ class FileWriterDelegateTestJob : public net::URLRequestJob { return 200; } + protected: + virtual ~FileWriterDelegateTestJob() {} + private: std::string content_; int remaining_bytes_; diff --git a/webkit/fileapi/obfuscated_file_util.cc b/webkit/fileapi/obfuscated_file_util.cc index 519afb4..2fe4c0f 100644 --- a/webkit/fileapi/obfuscated_file_util.cc +++ b/webkit/fileapi/obfuscated_file_util.cc @@ -271,10 +271,6 @@ ObfuscatedFileUtil::ObfuscatedFileUtil( file_system_directory_(file_system_directory) { } -ObfuscatedFileUtil::~ObfuscatedFileUtil() { - DropDatabases(); -} - PlatformFileError ObfuscatedFileUtil::CreateOrOpen( FileSystemOperationContext* context, const FileSystemPath& virtual_path, int file_flags, @@ -1006,6 +1002,10 @@ int64 ObfuscatedFileUtil::ComputeFilePathCost(const FilePath& path) { return UsageForPath(VirtualPath::BaseName(path).value().size()); } +ObfuscatedFileUtil::~ObfuscatedFileUtil() { + DropDatabases(); +} + PlatformFileError ObfuscatedFileUtil::GetFileInfoInternal( FileSystemDirectoryDatabase* db, FileSystemOperationContext* context, diff --git a/webkit/fileapi/obfuscated_file_util.h b/webkit/fileapi/obfuscated_file_util.h index fd7b21a..29fc5ea 100644 --- a/webkit/fileapi/obfuscated_file_util.h +++ b/webkit/fileapi/obfuscated_file_util.h @@ -43,7 +43,8 @@ class FileSystemOperationContext; // SandboxMountPointProvider [and the task it uses to drop the reference] and // SandboxMountPointProvider::GetFileSystemRootPathTask. Without that last one, // we wouldn't need ref counting. -class ObfuscatedFileUtil : public FileSystemFileUtil, +class ObfuscatedFileUtil : + public FileSystemFileUtil, public base::RefCountedThreadSafe<ObfuscatedFileUtil> { public: // Origin enumerator interface. @@ -65,7 +66,6 @@ class ObfuscatedFileUtil : public FileSystemFileUtil, // new ObfuscatedFileUtil(new NativeFileUtil()); ObfuscatedFileUtil(const FilePath& file_system_directory, FileSystemFileUtil* underlying_file_util); - virtual ~ObfuscatedFileUtil(); virtual base::PlatformFileError CreateOrOpen( FileSystemOperationContext* context, @@ -187,9 +187,13 @@ class ObfuscatedFileUtil : public FileSystemFileUtil, static int64 ComputeFilePathCost(const FilePath& path); private: + friend class base::RefCountedThreadSafe<ObfuscatedFileUtil>; + typedef FileSystemDirectoryDatabase::FileId FileId; typedef FileSystemDirectoryDatabase::FileInfo FileInfo; + virtual ~ObfuscatedFileUtil(); + base::PlatformFileError GetFileInfoInternal( FileSystemDirectoryDatabase* db, FileSystemOperationContext* context, |