OLD | NEW |
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 <deque> | 7 #include <deque> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 tracker_(tracker), | 27 tracker_(tracker), |
28 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 28 callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
29 DCHECK(tracker_); | 29 DCHECK(tracker_); |
30 DCHECK(client_); | 30 DCHECK(client_); |
31 client_tracker_ = tracker_->GetClientTracker(client_->id()); | 31 client_tracker_ = tracker_->GetClientTracker(client_->id()); |
32 DCHECK(client_tracker_); | 32 DCHECK(client_tracker_); |
33 } | 33 } |
34 virtual ~GatherUsageTaskBase() {} | 34 virtual ~GatherUsageTaskBase() {} |
35 | 35 |
36 // Get total usage for the given |origins|. | 36 // Get total usage for the given |origins|. |
37 void GetUsageForOrigins(const std::set<GURL>& origins) { | 37 void GetUsageForOrigins(const std::set<GURL>& origins, StorageType type) { |
38 DCHECK(original_message_loop()->BelongsToCurrentThread()); | 38 DCHECK(original_message_loop()->BelongsToCurrentThread()); |
39 std::set<GURL> origins_to_process; | 39 std::set<GURL> origins_to_process; |
40 // We do not get usage for origins for which we have valid usage cache. | 40 // We do not get usage for origins for which we have valid usage cache. |
41 client_tracker()->DetermineOriginsToGetUsage(origins, &origins_to_process); | 41 client_tracker()->DetermineOriginsToGetUsage(origins, &origins_to_process); |
42 if (origins_to_process.empty()) { | 42 if (origins_to_process.empty()) { |
43 CallCompleted(); | 43 CallCompleted(); |
44 DeleteSoon(); | 44 DeleteSoon(); |
45 return; | 45 return; |
46 } | 46 } |
47 | 47 |
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 // Dispatches the host usage callback. | 480 // Dispatches the host usage callback. |
481 host_usage_callbacks_.Run(host, host, type_, host_usage_map_[host]); | 481 host_usage_callbacks_.Run(host, host, type_, host_usage_map_[host]); |
482 } | 482 } |
483 | 483 |
484 bool ClientUsageTracker::IsStorageUnlimited(const GURL& origin) const { | 484 bool ClientUsageTracker::IsStorageUnlimited(const GURL& origin) const { |
485 return special_storage_policy_.get() && | 485 return special_storage_policy_.get() && |
486 special_storage_policy_->IsStorageUnlimited(origin); | 486 special_storage_policy_->IsStorageUnlimited(origin); |
487 } | 487 } |
488 | 488 |
489 } // namespace quota | 489 } // namespace quota |
OLD | NEW |