Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(634)

Unified Diff: webkit/fileapi/file_system_operation.cc

Issue 7671039: Count-up/down the dirty count in the usage cache at FileSystemOperation, not at QuotaFU. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Renamed ScopedOriginUpdateHelper. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_,

Powered by Google App Engine
This is Rietveld 408576698