Chromium Code Reviews| Index: webkit/quota/quota_manager.cc |
| diff --git a/webkit/quota/quota_manager.cc b/webkit/quota/quota_manager.cc |
| index 6bd37bdf6505a19b4a8907ad803b41aeb4f6e6eb..f9683eed5e90f421317aad26a2d1b16b6515165d 100644 |
| --- a/webkit/quota/quota_manager.cc |
| +++ b/webkit/quota/quota_manager.cc |
| @@ -524,7 +524,9 @@ QuotaManager::QuotaManager(bool is_incognito, |
| db_disabled_(false), |
| io_thread_(io_thread), |
| db_thread_(db_thread), |
| - temporary_global_quota_(-1) { |
| + get_usage_and_quota_for_eviction_members_(0, 0), |
| + temporary_global_quota_(-1), |
| + callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
| } |
| QuotaManager::~QuotaManager() { |
| @@ -780,9 +782,46 @@ void QuotaManager::EvictOriginData( |
| // TODO(dmikurube): Implement it. |
| } |
| +void QuotaManager::OnGetAvailableSpaceForEviction( |
| + QuotaStatusCode status, |
| + int64 available_space) { |
| + get_usage_and_quota_for_eviction_members_.callback_->Run( |
| + status, |
| + get_usage_and_quota_for_eviction_members_.usage_, |
| + get_usage_and_quota_for_eviction_members_.quota_, |
|
kinuko
2011/05/18 09:08:01
this variable name sounds way too long...? (please
Dai Mikurube (NOT FULLTIME)
2011/05/18 09:31:30
Done.
|
| + available_space); |
| + get_usage_and_quota_for_eviction_members_.callback_.reset(); |
| +} |
| + |
| +void QuotaManager::OnGetGlobalQuotaForEviction( |
| + QuotaStatusCode status, |
| + int64 quota) { |
| + if (status != kQuotaStatusOk) { |
| + get_usage_and_quota_for_eviction_members_.callback_->Run(status, |
| + get_usage_and_quota_for_eviction_members_.usage_, quota, 0); |
| + get_usage_and_quota_for_eviction_members_.callback_.reset(); |
| + return; |
| + } |
| + |
| + get_usage_and_quota_for_eviction_members_.quota_ = quota; |
| + GetAvailableSpace(callback_factory_. |
| + NewCallback(&QuotaManager::OnGetAvailableSpaceForEviction)); |
| +} |
| + |
| +void QuotaManager::OnGetGlobalUsageForEviction(int64 usage) { |
| + get_usage_and_quota_for_eviction_members_.usage_ = 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_members_.callback_.reset(callback); |
| + // TODO(dmikurube): Make kStorageTypeTemporary an argument? |
| + GetGlobalUsage(kStorageTypeTemporary, callback_factory_. |
| + NewCallback(&QuotaManager::OnGetGlobalUsageForEviction)); |
| } |
| void QuotaManager::DeleteOnCorrectThread() const { |