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

Unified Diff: webkit/quota/quota_manager.cc

Issue 7039006: Implement GetUsageAndQuotaForEviction in QuotaManager. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reflected the comments. Created 9 years, 7 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/quota/quota_manager.cc
diff --git a/webkit/quota/quota_manager.cc b/webkit/quota/quota_manager.cc
index 6bd37bdf6505a19b4a8907ad803b41aeb4f6e6eb..517a9ac526d765e9fba110fd0034d0d69c69b787 100644
--- a/webkit/quota/quota_manager.cc
+++ b/webkit/quota/quota_manager.cc
@@ -524,7 +524,8 @@ QuotaManager::QuotaManager(bool is_incognito,
db_disabled_(false),
io_thread_(io_thread),
db_thread_(db_thread),
- temporary_global_quota_(-1) {
+ temporary_global_quota_(-1),
+ callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
QuotaManager::~QuotaManager() {
@@ -780,9 +781,43 @@ void QuotaManager::EvictOriginData(
// TODO(dmikurube): Implement it.
}
+void QuotaManager::DidGetAvailableSpaceForEviction(
+ QuotaStatusCode status,
+ int64 available_space) {
+ eviction_context_.get_usage_and_quota_callback->Run(status,
+ eviction_context_.usage, eviction_context_.quota, available_space);
+ eviction_context_.get_usage_and_quota_callback.reset();
+}
+
+void QuotaManager::DidGetGlobalQuotaForEviction(
+ QuotaStatusCode status,
+ int64 quota) {
+ if (status != kQuotaStatusOk) {
+ eviction_context_.get_usage_and_quota_callback->Run(status,
+ eviction_context_.usage, quota, 0);
+ eviction_context_.get_usage_and_quota_callback.reset();
+ return;
+ }
+
+ eviction_context_.quota = quota;
+ GetAvailableSpace(callback_factory_.
+ NewCallback(&QuotaManager::DidGetAvailableSpaceForEviction));
+}
+
+void QuotaManager::DidGetGlobalUsageForEviction(int64 usage) {
+ eviction_context_.usage = usage;
+ GetTemporaryGlobalQuota(callback_factory_.
+ NewCallback(&QuotaManager::DidGetGlobalQuotaForEviction));
+}
+
void QuotaManager::GetUsageAndQuotaForEviction(
GetUsageAndQuotaForEvictionCallback* callback) {
- // TODO(dmikurube): Implement it.
+ DCHECK(io_thread_->BelongsToCurrentThread());
+
kinuko 2011/05/18 10:02:45 DCHECK(!get_usage_and_quota_callback.get()) here?
Dai Mikurube (NOT FULLTIME) 2011/05/18 11:35:25 Done.
+ eviction_context_.get_usage_and_quota_callback.reset(callback);
+ // TODO(dmikurube): Make kStorageTypeTemporary an argument?
+ GetGlobalUsage(kStorageTypeTemporary, callback_factory_.
+ NewCallback(&QuotaManager::DidGetGlobalUsageForEviction));
}
void QuotaManager::DeleteOnCorrectThread() const {

Powered by Google App Engine
This is Rietveld 408576698