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

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: Reflected the comments. 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
« no previous file with comments | « webkit/fileapi/file_system_operation.h ('k') | webkit/fileapi/quota_file_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..9f0049066c03068f02b6b49f668b0f480356e6c6 100644
--- a/webkit/fileapi/file_system_operation.cc
+++ b/webkit/fileapi/file_system_operation.cc
@@ -23,6 +23,39 @@
namespace fileapi {
+class FileSystemOperation::ScopedQuotaUtilHelper {
+ public:
+ explicit ScopedQuotaUtilHelper(FileSystemContext* context,
kinuko 2011/08/30 12:31:20 no need to make this explicit?
Dai Mikurube (NOT FULLTIME) 2011/08/30 12:41:23 Done.
+ const GURL& origin_url,
+ FileSystemType type);
+ ~ScopedQuotaUtilHelper();
+
+ private:
+ FileSystemQuotaUtil* quota_util_;
+ const GURL& origin_url_;
+ FileSystemType type_;
+ DISALLOW_COPY_AND_ASSIGN(ScopedQuotaUtilHelper);
+};
+
+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 +137,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 +191,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 +253,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 +314,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 +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_,
@@ -488,6 +551,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 +651,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_,
« no previous file with comments | « webkit/fileapi/file_system_operation.h ('k') | webkit/fileapi/quota_file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698