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

Unified Diff: webkit/browser/quota/quota_manager.cc

Issue 59753008: Quota: Add proxy for QuotaManager::GetUsageAndQuota (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: SingleThreadTaskRunner -> SequencedTaskRunner Created 7 years, 1 month 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/browser/quota/quota_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/browser/quota/quota_manager.cc
diff --git a/webkit/browser/quota/quota_manager.cc b/webkit/browser/quota/quota_manager.cc
index 5df4231713a32b031ec6ceba2413d6764e940597..123307ef034b7a7ebcbc58fd4b2b071dcb682e14 100644
--- a/webkit/browser/quota/quota_manager.cc
+++ b/webkit/browser/quota/quota_manager.cc
@@ -43,6 +43,21 @@ const int kMinutesInMilliSeconds = 60 * 1000;
const int64 kReportHistogramInterval = 60 * 60 * 1000; // 1 hour
const double kTemporaryQuotaRatioToAvail = 1.0 / 3.0; // 33%
+void DidGetUsageAndQuota(
+ base::SequencedTaskRunner* original_task_runner,
+ const QuotaManagerProxy::GetUsageAndQuotaCallback& callback,
+ QuotaStatusCode status, int64 usage, int64 quota) {
+ if (!original_task_runner->RunsTasksOnCurrentThread()) {
+ original_task_runner->PostTask(
+ FROM_HERE,
+ base::Bind(&DidGetUsageAndQuota,
+ make_scoped_refptr(original_task_runner),
+ callback, status, usage, quota));
+ return;
+ }
+ callback.Run(status, usage, quota);
+}
+
} // namespace
// Arbitrary for now, but must be reasonably small so that
@@ -1680,6 +1695,29 @@ void QuotaManagerProxy::SetUsageCacheEnabled(QuotaClient::ID client_id,
manager_->SetUsageCacheEnabled(client_id, origin, type, enabled);
}
+void QuotaManagerProxy::GetUsageAndQuota(
+ base::SequencedTaskRunner* original_task_runner,
+ const GURL& origin,
+ StorageType type,
+ const GetUsageAndQuotaCallback& callback) {
+ if (!io_thread_->BelongsToCurrentThread()) {
+ io_thread_->PostTask(
+ FROM_HERE,
+ base::Bind(&QuotaManagerProxy::GetUsageAndQuota, this,
+ make_scoped_refptr(original_task_runner),
+ origin, type, callback));
+ return;
+ }
+ if (!manager_) {
+ DidGetUsageAndQuota(original_task_runner, callback, kQuotaErrorAbort, 0, 0);
+ return;
+ }
+ manager_->GetUsageAndQuota(
+ origin, type,
+ base::Bind(&DidGetUsageAndQuota,
+ make_scoped_refptr(original_task_runner), callback));
+}
+
QuotaManager* QuotaManagerProxy::quota_manager() const {
DCHECK(!io_thread_.get() || io_thread_->BelongsToCurrentThread());
return manager_;
« no previous file with comments | « webkit/browser/quota/quota_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698