Index: webkit/fileapi/file_system_operation.cc |
diff --git a/webkit/fileapi/file_system_operation.cc b/webkit/fileapi/file_system_operation.cc |
index 4391f3615fc2d445ae03aed958bc3fa2ad59243b..e2c80afb97c629de11abb1b14ed7ec11ba2a459d 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, |
@@ -104,6 +123,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_, |
@@ -152,6 +177,12 @@ void FileSystemOperation::DelayedCreateDirectoryForQuota( |
} 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::CreateDirectory( |
file_system_operation_context_, |
proxy_, |
@@ -208,6 +239,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_, |
@@ -263,6 +300,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_, |
@@ -444,6 +487,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_, |
@@ -488,6 +537,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_, |
@@ -582,6 +637,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_, |