summaryrefslogtreecommitdiffstats
path: root/webkit/quota
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 18:27:57 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-12 18:27:57 +0000
commit13bbca7b2d63071a8821786378f6ef6eba605c10 (patch)
treea6dc209924700070fbb9d6293e1326d52425b252 /webkit/quota
parent5fa7d164815ac83d61f3c6c683b3ca77d259b56d (diff)
downloadchromium_src-13bbca7b2d63071a8821786378f6ef6eba605c10.zip
chromium_src-13bbca7b2d63071a8821786378f6ef6eba605c10.tar.gz
chromium_src-13bbca7b2d63071a8821786378f6ef6eba605c10.tar.bz2
Minor cleanup to UsageTracker.IsWorking().
Review URL: http://codereview.chromium.org/7634013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96583 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/quota')
-rw-r--r--webkit/quota/quota_manager.cc4
-rw-r--r--webkit/quota/quota_types.h4
-rw-r--r--webkit/quota/usage_tracker.cc13
-rw-r--r--webkit/quota/usage_tracker.h6
4 files changed, 10 insertions, 17 deletions
diff --git a/webkit/quota/quota_manager.cc b/webkit/quota/quota_manager.cc
index ef4254f..b5d9196 100644
--- a/webkit/quota/quota_manager.cc
+++ b/webkit/quota/quota_manager.cc
@@ -1183,14 +1183,14 @@ void QuotaManager::DeleteOriginData(
bool QuotaManager::ResetUsageTracker(StorageType type) {
switch (type) {
case kStorageTypeTemporary:
- if (!temporary_usage_tracker_->IsWorking())
+ if (temporary_usage_tracker_->IsWorking())
return false;
temporary_usage_tracker_.reset(
new UsageTracker(clients_, kStorageTypeTemporary,
special_storage_policy_));
return true;
case kStorageTypePersistent:
- if (!persistent_usage_tracker_->IsWorking())
+ if (persistent_usage_tracker_->IsWorking())
return false;
persistent_usage_tracker_.reset(
new UsageTracker(clients_, kStorageTypePersistent,
diff --git a/webkit/quota/quota_types.h b/webkit/quota/quota_types.h
index 455925d..5e12536 100644
--- a/webkit/quota/quota_types.h
+++ b/webkit/quota/quota_types.h
@@ -163,6 +163,10 @@ class CallbackQueueMapBase {
return (callback_map_.find(key) != callback_map_.end());
}
+ bool HasAnyCallbacks() const {
+ return !callback_map_.empty();
+ }
+
iterator Begin() { return callback_map_.begin(); }
iterator End() { return callback_map_.end(); }
diff --git a/webkit/quota/usage_tracker.cc b/webkit/quota/usage_tracker.cc
index df440ee..9a98bb1 100644
--- a/webkit/quota/usage_tracker.cc
+++ b/webkit/quota/usage_tracker.cc
@@ -323,19 +323,6 @@ void UsageTracker::DidGetClientHostUsage(const std::string& host,
}
}
-bool UsageTracker::IsWorking() {
- if (global_usage_.pending_clients > 0)
- return false;
- for (std::map<std::string, TrackingInfo>::iterator iter =
- outstanding_host_usage_.begin();
- iter != outstanding_host_usage_.end();
- ++iter) {
- if (iter->second.pending_clients > 0)
- return false;
- }
- return true;
-}
-
// ClientUsageTracker ----------------------------------------------------
ClientUsageTracker::ClientUsageTracker(
diff --git a/webkit/quota/usage_tracker.h b/webkit/quota/usage_tracker.h
index 53a58c6c..b4fc51b 100644
--- a/webkit/quota/usage_tracker.h
+++ b/webkit/quota/usage_tracker.h
@@ -42,9 +42,11 @@ class UsageTracker : public QuotaTaskObserver {
void UpdateUsageCache(QuotaClient::ID client_id,
const GURL& origin,
int64 delta);
-
void GetCachedOrigins(std::set<GURL>* origins) const;
- bool IsWorking();
+ bool IsWorking() const {
+ return global_usage_callbacks_.HasCallbacks() ||
+ host_usage_callbacks_.HasAnyCallbacks();
+ }
private:
struct TrackingInfo {