OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_CLIENT_USAGE_TRACKER_H_ | 5 #ifndef STORAGE_BROWSER_QUOTA_CLIENT_USAGE_TRACKER_H_ |
6 #define STORAGE_BROWSER_QUOTA_CLIENT_USAGE_TRACKER_H_ | 6 #define STORAGE_BROWSER_QUOTA_CLIENT_USAGE_TRACKER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 QuotaClient* client, | 45 QuotaClient* client, |
46 StorageType type, | 46 StorageType type, |
47 SpecialStoragePolicy* special_storage_policy, | 47 SpecialStoragePolicy* special_storage_policy, |
48 StorageMonitor* storage_monitor); | 48 StorageMonitor* storage_monitor); |
49 ~ClientUsageTracker() override; | 49 ~ClientUsageTracker() override; |
50 | 50 |
51 void GetGlobalLimitedUsage(const UsageCallback& callback); | 51 void GetGlobalLimitedUsage(const UsageCallback& callback); |
52 void GetGlobalUsage(const GlobalUsageCallback& callback); | 52 void GetGlobalUsage(const GlobalUsageCallback& callback); |
53 void GetHostUsage(const std::string& host, const UsageCallback& callback); | 53 void GetHostUsage(const std::string& host, const UsageCallback& callback); |
54 void UpdateUsageCache(const GURL& origin, int64_t delta); | 54 void UpdateUsageCache(const GURL& origin, int64_t delta); |
| 55 int64_t GetCachedUsage() const; |
55 void GetCachedHostsUsage(std::map<std::string, int64_t>* host_usage) const; | 56 void GetCachedHostsUsage(std::map<std::string, int64_t>* host_usage) const; |
56 void GetCachedOriginsUsage(std::map<GURL, int64_t>* origin_usage) const; | 57 void GetCachedOriginsUsage(std::map<GURL, int64_t>* origin_usage) const; |
57 void GetCachedOrigins(std::set<GURL>* origins) const; | 58 void GetCachedOrigins(std::set<GURL>* origins) const; |
58 bool IsUsageCacheEnabledForOrigin(const GURL& origin) const; | 59 bool IsUsageCacheEnabledForOrigin(const GURL& origin) const; |
59 void SetUsageCacheEnabled(const GURL& origin, bool enabled); | 60 void SetUsageCacheEnabled(const GURL& origin, bool enabled); |
60 | 61 |
61 private: | 62 private: |
62 typedef CallbackQueueMap<HostUsageAccumulator, std::string, int64_t, int64_t> | 63 typedef CallbackQueueMap<HostUsageAccumulator, std::string, int64_t, int64_t> |
63 HostUsageAccumulatorMap; | 64 HostUsageAccumulatorMap; |
64 | 65 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 HostUsageAccumulatorMap host_usage_accumulators_; | 131 HostUsageAccumulatorMap host_usage_accumulators_; |
131 | 132 |
132 scoped_refptr<SpecialStoragePolicy> special_storage_policy_; | 133 scoped_refptr<SpecialStoragePolicy> special_storage_policy_; |
133 | 134 |
134 DISALLOW_COPY_AND_ASSIGN(ClientUsageTracker); | 135 DISALLOW_COPY_AND_ASSIGN(ClientUsageTracker); |
135 }; | 136 }; |
136 | 137 |
137 } // namespace storage | 138 } // namespace storage |
138 | 139 |
139 #endif // STORAGE_BROWSER_QUOTA_CLIENT_USAGE_TRACKER_H_ | 140 #endif // STORAGE_BROWSER_QUOTA_CLIENT_USAGE_TRACKER_H_ |
OLD | NEW |