Chromium Code Reviews| Index: webkit/quota/quota_manager.cc |
| diff --git a/webkit/quota/quota_manager.cc b/webkit/quota/quota_manager.cc |
| index 730ec8dae37b4c44c5ed73a44f6190f8dbdce816..9607f6d509ee4c8e65ba76f4012630b3cbeef035 100644 |
| --- a/webkit/quota/quota_manager.cc |
| +++ b/webkit/quota/quota_manager.cc |
| @@ -77,11 +77,15 @@ const int QuotaManager::kEvictionIntervalInMilliSeconds = |
| void CallGetUsageAndQuotaCallback( |
| const QuotaManager::GetUsageAndQuotaCallback& callback, |
| bool unlimited, |
| + const FilePath& path, |
| QuotaStatusCode status, |
| const QuotaAndUsage& quota_and_usage) { |
| int64 usage = |
| unlimited ? quota_and_usage.unlimited_usage : quota_and_usage.usage; |
| - int64 quota = unlimited ? QuotaManager::kNoLimit : quota_and_usage.quota; |
| + printf("unlimited: %d\n", unlimited); |
| + int64 quota = unlimited ? quota_and_usage.available_disk_space : |
|
kinuko
2012/08/13 14:07:52
(You might be changing this but to make sure) I th
James Hawkins
2012/08/17 21:33:22
I'm attempting to add support for this check now,
|
| + quota_and_usage.quota; |
| + printf("quota: %ld\n", quota); |
| callback.Run(status, usage, quota); |
| } |
| @@ -406,6 +410,7 @@ class QuotaManager::UsageAndQuotaDispatcherTaskForPersistent |
| host(), NewWaitableHostUsageCallback()); |
| manager()->GetPersistentHostQuota( |
| host(), NewWaitableHostQuotaCallback()); |
| + manager()->GetAvailableSpace(NewWaitableAvailableSpaceCallback()); |
| } |
| virtual void DispatchCallbacks() OVERRIDE { |
| @@ -955,7 +960,7 @@ class QuotaManager::AvailableSpaceQueryTask : public QuotaThreadTask { |
| QuotaManager* manager, |
| const AvailableSpaceCallback& callback) |
| : QuotaThreadTask(manager, manager->db_thread_), |
| - profile_path_(manager->profile_path_), |
| + quota_manager_(manager), |
| space_(-1), |
| callback_(callback) { |
| } |
| @@ -965,7 +970,7 @@ class QuotaManager::AvailableSpaceQueryTask : public QuotaThreadTask { |
| // QuotaThreadTask: |
| virtual void RunOnTargetThread() OVERRIDE { |
| - space_ = base::SysInfo::AmountOfFreeDiskSpace(profile_path_); |
| + space_ = quota_manager_->GetAvailableDiskSpace(); |
| } |
| virtual void Aborted() OVERRIDE { |
| @@ -977,7 +982,7 @@ class QuotaManager::AvailableSpaceQueryTask : public QuotaThreadTask { |
| } |
| private: |
| - FilePath profile_path_; |
| + scoped_refptr<QuotaManager> quota_manager_; |
| int64 space_; |
| AvailableSpaceCallback callback_; |
| }; |
| @@ -1212,9 +1217,10 @@ void QuotaManager::GetUsageInfo(const GetUsageInfoCallback& callback) { |
| void QuotaManager::GetUsageAndQuota( |
| const GURL& origin, StorageType type, |
| const GetUsageAndQuotaCallback& callback) { |
| - GetUsageAndQuotaInternal(origin, type, false /* global */, |
| - base::Bind(&CallGetUsageAndQuotaCallback, |
| - callback, IsStorageUnlimited(origin))); |
| + GetUsageAndQuotaInternal( |
| + origin, type, false /* global */, |
| + base::Bind(&CallGetUsageAndQuotaCallback, callback, |
| + IsStorageUnlimited(origin), profile_path_)); |
| } |
| void QuotaManager::GetAvailableSpace(const AvailableSpaceCallback& callback) { |
| @@ -1334,6 +1340,7 @@ void QuotaManager::GetOriginsModifiedSince(StorageType type, |
| } |
| QuotaManager::~QuotaManager() { |
| + printf("~QuotaManager\n"); |
| proxy_->manager_ = NULL; |
| std::for_each(clients_.begin(), clients_.end(), |
| std::mem_fun(&QuotaClient::OnQuotaManagerDestroyed)); |
| @@ -1341,6 +1348,10 @@ QuotaManager::~QuotaManager() { |
| db_thread_->DeleteSoon(FROM_HERE, database_.release()); |
| } |
| +int64 QuotaManager::GetAvailableDiskSpace() const { |
| + return base::SysInfo::AmountOfFreeDiskSpace(profile_path_); |
|
kinuko
2012/08/13 14:07:52
Hmm. How about using a static function pointer (w
|
| +} |
| + |
| void QuotaManager::LazyInitialize() { |
| DCHECK(io_thread_->BelongsToCurrentThread()); |
| if (database_.get()) { |