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

Side by Side Diff: webkit/quota/usage_tracker.cc

Issue 7634013: Minor cleanup to UsageTracker.IsWorking(). (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/quota/usage_tracker.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/quota/usage_tracker.h" 5 #include "webkit/quota/usage_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <string> 10 #include <string>
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 // Defend against confusing inputs from clients. 316 // Defend against confusing inputs from clients.
317 if (info.usage < 0) 317 if (info.usage < 0)
318 info.usage = 0; 318 info.usage = 0;
319 // All the clients have returned their usage data. Dispatches the 319 // All the clients have returned their usage data. Dispatches the
320 // pending callbacks. 320 // pending callbacks.
321 host_usage_callbacks_.Run(host, host, type, info.usage); 321 host_usage_callbacks_.Run(host, host, type, info.usage);
322 outstanding_host_usage_.erase(host); 322 outstanding_host_usage_.erase(host);
323 } 323 }
324 } 324 }
325 325
326 bool UsageTracker::IsWorking() {
327 if (global_usage_.pending_clients > 0)
328 return false;
329 for (std::map<std::string, TrackingInfo>::iterator iter =
330 outstanding_host_usage_.begin();
331 iter != outstanding_host_usage_.end();
332 ++iter) {
333 if (iter->second.pending_clients > 0)
334 return false;
335 }
336 return true;
337 }
338
339 // ClientUsageTracker ---------------------------------------------------- 326 // ClientUsageTracker ----------------------------------------------------
340 327
341 ClientUsageTracker::ClientUsageTracker( 328 ClientUsageTracker::ClientUsageTracker(
342 UsageTracker* tracker, QuotaClient* client, StorageType type, 329 UsageTracker* tracker, QuotaClient* client, StorageType type,
343 SpecialStoragePolicy* special_storage_policy) 330 SpecialStoragePolicy* special_storage_policy)
344 : tracker_(tracker), 331 : tracker_(tracker),
345 client_(client), 332 client_(client),
346 type_(type), 333 type_(type),
347 global_usage_(0), 334 global_usage_(0),
348 global_unlimited_usage_(0), 335 global_unlimited_usage_(0),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 void ClientUsageTracker::NoopHostUsageCallback( 461 void ClientUsageTracker::NoopHostUsageCallback(
475 const std::string& host, StorageType type, int64 usage) { 462 const std::string& host, StorageType type, int64 usage) {
476 } 463 }
477 464
478 bool ClientUsageTracker::IsStorageUnlimited(const GURL& origin) const { 465 bool ClientUsageTracker::IsStorageUnlimited(const GURL& origin) const {
479 return special_storage_policy_.get() && 466 return special_storage_policy_.get() &&
480 special_storage_policy_->IsStorageUnlimited(origin); 467 special_storage_policy_->IsStorageUnlimited(origin);
481 } 468 }
482 469
483 } // namespace quota 470 } // namespace quota
OLDNEW
« no previous file with comments | « webkit/quota/usage_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698