OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ | 5 #ifndef STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ |
6 #define STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ | 6 #define STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 StorageType type() const { return type_; } | 41 StorageType type() const { return type_; } |
42 ClientUsageTracker* GetClientTracker(QuotaClient::ID client_id); | 42 ClientUsageTracker* GetClientTracker(QuotaClient::ID client_id); |
43 | 43 |
44 void GetGlobalLimitedUsage(const UsageCallback& callback); | 44 void GetGlobalLimitedUsage(const UsageCallback& callback); |
45 void GetGlobalUsage(const GlobalUsageCallback& callback); | 45 void GetGlobalUsage(const GlobalUsageCallback& callback); |
46 void GetHostUsage(const std::string& host, const UsageCallback& callback); | 46 void GetHostUsage(const std::string& host, const UsageCallback& callback); |
47 void UpdateUsageCache(QuotaClient::ID client_id, | 47 void UpdateUsageCache(QuotaClient::ID client_id, |
48 const GURL& origin, | 48 const GURL& origin, |
49 int64_t delta); | 49 int64_t delta); |
| 50 int64_t GetCachedUsage() const; |
| 51 void GetCachedHostsUsage(std::map<std::string, int64_t>* host_usage) const; |
50 void GetCachedOriginsUsage(std::map<GURL, int64_t>* origin_usage) const; | 52 void GetCachedOriginsUsage(std::map<GURL, int64_t>* origin_usage) const; |
51 void GetCachedHostsUsage(std::map<std::string, int64_t>* host_usage) const; | |
52 void GetCachedOrigins(std::set<GURL>* origins) const; | 53 void GetCachedOrigins(std::set<GURL>* origins) const; |
53 bool IsWorking() const { | 54 bool IsWorking() const { |
54 return global_usage_callbacks_.HasCallbacks() || | 55 return global_usage_callbacks_.HasCallbacks() || |
55 host_usage_callbacks_.HasAnyCallbacks(); | 56 host_usage_callbacks_.HasAnyCallbacks(); |
56 } | 57 } |
57 | 58 |
58 void SetUsageCacheEnabled(QuotaClient::ID client_id, | 59 void SetUsageCacheEnabled(QuotaClient::ID client_id, |
59 const GURL& origin, | 60 const GURL& origin, |
60 bool enabled); | 61 bool enabled); |
61 | 62 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 | 95 |
95 StorageMonitor* storage_monitor_; | 96 StorageMonitor* storage_monitor_; |
96 | 97 |
97 base::WeakPtrFactory<UsageTracker> weak_factory_; | 98 base::WeakPtrFactory<UsageTracker> weak_factory_; |
98 DISALLOW_COPY_AND_ASSIGN(UsageTracker); | 99 DISALLOW_COPY_AND_ASSIGN(UsageTracker); |
99 }; | 100 }; |
100 | 101 |
101 } // namespace storage | 102 } // namespace storage |
102 | 103 |
103 #endif // STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ | 104 #endif // STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ |
OLD | NEW |