Index: webkit/quota/quota_manager.cc |
diff --git a/webkit/quota/quota_manager.cc b/webkit/quota/quota_manager.cc |
index 6bd37bdf6505a19b4a8907ad803b41aeb4f6e6eb..4d54247096ec9349ca801fce35303afa33dfea1b 100644 |
--- a/webkit/quota/quota_manager.cc |
+++ b/webkit/quota/quota_manager.cc |
@@ -524,7 +524,10 @@ QuotaManager::QuotaManager(bool is_incognito, |
db_disabled_(false), |
io_thread_(io_thread), |
db_thread_(db_thread), |
- temporary_global_quota_(-1) { |
+ usage_for_eviction_(0), |
+ quota_for_eviction_(0), |
kinuko
2011/05/18 06:26:55
Now I seriously started wondering if we could have
Dai Mikurube (NOT FULLTIME)
2011/05/18 06:37:20
I agree with that, but how about doing that later
|
+ temporary_global_quota_(-1), |
+ callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
} |
QuotaManager::~QuotaManager() { |
@@ -780,9 +783,43 @@ void QuotaManager::EvictOriginData( |
// TODO(dmikurube): Implement it. |
} |
+void QuotaManager::OnGetAvailableSpaceForEviction( |
+ QuotaStatusCode status, |
+ int64 available_space) { |
+ get_usage_and_quota_for_eviction_callback_->Run(status, |
+ usage_for_eviction_, quota_for_eviction_, available_space); |
+ get_usage_and_quota_for_eviction_callback_.reset(); |
+} |
+ |
+void QuotaManager::OnGetGlobalQuotaForEviction( |
+ QuotaStatusCode status, |
+ int64 quota) { |
+ if (status != kQuotaStatusOk) { |
+ get_usage_and_quota_for_eviction_callback_->Run(status, |
+ usage_for_eviction_, quota, 0); |
+ get_usage_and_quota_for_eviction_callback_.reset(); |
+ return; |
+ } |
+ |
+ quota_for_eviction_ = quota; |
+ GetAvailableSpace(callback_factory_. |
+ NewCallback(&QuotaManager::OnGetAvailableSpaceForEviction)); |
kinuko
2011/05/18 06:26:55
We could call all those async methods at once and
Dai Mikurube (NOT FULLTIME)
2011/05/18 06:37:20
Is that a serious requirement? Calling them async
|
+} |
+ |
+void QuotaManager::OnGetGlobalUsageForEviction(int64 usage) { |
+ usage_for_eviction_ = usage; |
+ GetTemporaryGlobalQuota(callback_factory_. |
+ NewCallback(&QuotaManager::OnGetGlobalQuotaForEviction)); |
+} |
+ |
void QuotaManager::GetUsageAndQuotaForEviction( |
GetUsageAndQuotaForEvictionCallback* callback) { |
- // TODO(dmikurube): Implement it. |
+ DCHECK(io_thread_->BelongsToCurrentThread()); |
+ |
+ get_usage_and_quota_for_eviction_callback_.reset(callback); |
+ // TODO(dmikurube): Make kStorageTypeTemporary an argument? |
kinuko
2011/05/18 06:26:55
I think we should either add or drop the type para
Dai Mikurube (NOT FULLTIME)
2011/05/18 06:37:20
I think we might want to do that as a refactoring
|
+ GetGlobalUsage(kStorageTypeTemporary, callback_factory_. |
+ NewCallback(&QuotaManager::OnGetGlobalUsageForEviction)); |
} |
void QuotaManager::DeleteOnCorrectThread() const { |