Chromium Code Reviews| Index: webkit/fileapi/file_system_operation.cc |
| diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc |
| index c2281ccc43fc28477afea4a5506e9b3b3fb211e1..97fe83da48f50a81f47e71cbc15f54888b70700f 100644 |
| --- a/webkit/fileapi/file_system_operation.cc |
| +++ b/webkit/fileapi/file_system_operation.cc |
| @@ -23,6 +23,25 @@ |
| namespace fileapi { |
| +FileSystemOperation::ScopedQuotaUtilHelper::ScopedQuotaUtilHelper( |
| + FileSystemContext* context, const GURL& origin_url, FileSystemType type) |
| + : origin_url_(origin_url), type_(type) { |
| + DCHECK(context); |
| + DCHECK(type != kFileSystemTypeUnknown); |
| + quota_util_ = context->GetQuotaUtil(type_); |
| + if (quota_util_) { |
| + DCHECK(quota_util_->proxy()); |
| + quota_util_->proxy()->StartUpdateOrigin(origin_url_, type_); |
| + } |
| +} |
| + |
| +FileSystemOperation::ScopedQuotaUtilHelper::~ScopedQuotaUtilHelper() { |
| + if (quota_util_) { |
| + DCHECK(quota_util_->proxy()); |
| + quota_util_->proxy()->EndUpdateOrigin(origin_url_, type_); |
| + } |
| +} |
| + |
| FileSystemOperation::FileSystemOperation( |
| FileSystemCallbackDispatcher* dispatcher, |
| scoped_refptr<base::MessageLoopProxy> proxy, |
| @@ -106,6 +125,12 @@ void FileSystemOperation::DelayedCreateFileForQuota( |
| } else { |
| file_system_operation_context_.set_allowed_bytes_growth(quota - usage); |
| } |
| + |
| + quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
| + file_system_context(), |
| + file_system_operation_context_.src_origin_url(), |
| + file_system_operation_context_.src_type())); |
| + |
| FileSystemFileUtilProxy::EnsureFileExists( |
| file_system_operation_context_, |
| proxy_, |
| @@ -156,6 +181,12 @@ void FileSystemOperation::DelayedCreateDirectoryForQuota( |
| } else { |
| file_system_operation_context_.set_allowed_bytes_growth(quota - usage); |
| } |
| + |
| + quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
|
ericu
2011/08/19 04:12:59
This feels a bit odd here, given that many filesys
Dai Mikurube (NOT FULLTIME)
2011/08/19 10:21:10
I basically agree with that, but I guess it has a
kinuko
2011/08/19 11:13:08
I'm ok with eric's proposal iff we can make sure t
|
| + file_system_context(), |
| + file_system_operation_context_.src_origin_url(), |
| + file_system_operation_context_.src_type())); |
| + |
| FileSystemFileUtilProxy::CreateDirectory( |
| file_system_operation_context_, |
| proxy_, |
| @@ -216,6 +247,12 @@ void FileSystemOperation::DelayedCopyForQuota(quota::QuotaStatusCode status, |
| } else { |
| file_system_operation_context_.set_allowed_bytes_growth(quota - usage); |
| } |
| + |
| + quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
| + file_system_context(), |
| + file_system_operation_context_.dest_origin_url(), |
| + file_system_operation_context_.dest_type())); |
| + |
| FileSystemFileUtilProxy::Copy( |
| file_system_operation_context_, |
| proxy_, |
| @@ -275,6 +312,12 @@ void FileSystemOperation::DelayedMoveForQuota(quota::QuotaStatusCode status, |
| } else { |
| file_system_operation_context_.set_allowed_bytes_growth(quota - usage); |
| } |
| + |
| + quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
| + file_system_context(), |
| + file_system_operation_context_.dest_origin_url(), |
| + file_system_operation_context_.dest_type())); |
| + |
| FileSystemFileUtilProxy::Move( |
| file_system_operation_context_, |
| proxy_, |
| @@ -458,6 +501,12 @@ void FileSystemOperation::DelayedWriteForQuota(quota::QuotaStatusCode status, |
| } else { |
| file_system_operation_context_.set_allowed_bytes_growth(quota - usage); |
| } |
| + |
| + quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
| + file_system_context(), |
| + file_system_operation_context_.src_origin_url(), |
| + file_system_operation_context_.src_type())); |
| + |
| FileSystemFileUtilProxy::CreateOrOpen( |
| file_system_operation_context_, |
| proxy_, |
| @@ -504,6 +553,12 @@ void FileSystemOperation::DelayedTruncateForQuota(quota::QuotaStatusCode status, |
| } else { |
| file_system_operation_context_.set_allowed_bytes_growth(quota - usage); |
| } |
| + |
| + quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
| + file_system_context(), |
| + file_system_operation_context_.src_origin_url(), |
| + file_system_operation_context_.src_type())); |
| + |
| FileSystemFileUtilProxy::Truncate( |
| file_system_operation_context_, |
| proxy_, |
| @@ -600,6 +655,11 @@ void FileSystemOperation::DelayedOpenFileForQuota(quota::QuotaStatusCode status, |
| file_system_operation_context_.set_allowed_bytes_growth(quota - usage); |
| } |
| + quota_util_helper_.reset(new ScopedQuotaUtilHelper( |
| + file_system_context(), |
| + file_system_operation_context_.src_origin_url(), |
| + file_system_operation_context_.src_type())); |
| + |
| FileSystemFileUtilProxy::CreateOrOpen( |
| file_system_operation_context_, |
| proxy_, |