| 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 <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 // Methods used by our GatherUsage tasks, as a task makes progress | 162 // Methods used by our GatherUsage tasks, as a task makes progress |
| 163 // origins and hosts are added incrementally to the cache. | 163 // origins and hosts are added incrementally to the cache. |
| 164 void AddCachedOrigin(const GURL& origin, int64 usage); | 164 void AddCachedOrigin(const GURL& origin, int64 usage); |
| 165 void AddCachedHost(const std::string& host); | 165 void AddCachedHost(const std::string& host); |
| 166 | 166 |
| 167 int64 GetCachedHostUsage(const std::string& host) const; | 167 int64 GetCachedHostUsage(const std::string& host) const; |
| 168 int64 GetCachedGlobalUnlimitedUsage(); | 168 int64 GetCachedGlobalUnlimitedUsage(); |
| 169 bool GetCachedOriginUsage(const GURL& origin, int64* usage) const; | 169 bool GetCachedOriginUsage(const GURL& origin, int64* usage) const; |
| 170 | 170 |
| 171 // SpecialStoragePolicy::Observer overrides | 171 // SpecialStoragePolicy::Observer overrides |
| 172 virtual void OnGranted(const GURL& origin, int change_flags) OVERRIDE; | 172 virtual void OnGranted(const GURL& origin, int change_flags) override; |
| 173 virtual void OnRevoked(const GURL& origin, int change_flags) OVERRIDE; | 173 virtual void OnRevoked(const GURL& origin, int change_flags) override; |
| 174 virtual void OnCleared() OVERRIDE; | 174 virtual void OnCleared() override; |
| 175 | 175 |
| 176 bool IsStorageUnlimited(const GURL& origin) const; | 176 bool IsStorageUnlimited(const GURL& origin) const; |
| 177 | 177 |
| 178 UsageTracker* tracker_; | 178 UsageTracker* tracker_; |
| 179 QuotaClient* client_; | 179 QuotaClient* client_; |
| 180 const StorageType type_; | 180 const StorageType type_; |
| 181 StorageMonitor* storage_monitor_; | 181 StorageMonitor* storage_monitor_; |
| 182 | 182 |
| 183 int64 global_limited_usage_; | 183 int64 global_limited_usage_; |
| 184 int64 global_unlimited_usage_; | 184 int64 global_unlimited_usage_; |
| 185 bool global_usage_retrieved_; | 185 bool global_usage_retrieved_; |
| 186 HostSet cached_hosts_; | 186 HostSet cached_hosts_; |
| 187 HostUsageMap cached_usage_by_host_; | 187 HostUsageMap cached_usage_by_host_; |
| 188 | 188 |
| 189 OriginSetByHost non_cached_limited_origins_by_host_; | 189 OriginSetByHost non_cached_limited_origins_by_host_; |
| 190 OriginSetByHost non_cached_unlimited_origins_by_host_; | 190 OriginSetByHost non_cached_unlimited_origins_by_host_; |
| 191 | 191 |
| 192 GlobalUsageCallbackQueue global_usage_callback_; | 192 GlobalUsageCallbackQueue global_usage_callback_; |
| 193 HostUsageAccumulatorMap host_usage_accumulators_; | 193 HostUsageAccumulatorMap host_usage_accumulators_; |
| 194 | 194 |
| 195 scoped_refptr<SpecialStoragePolicy> special_storage_policy_; | 195 scoped_refptr<SpecialStoragePolicy> special_storage_policy_; |
| 196 | 196 |
| 197 DISALLOW_COPY_AND_ASSIGN(ClientUsageTracker); | 197 DISALLOW_COPY_AND_ASSIGN(ClientUsageTracker); |
| 198 }; | 198 }; |
| 199 | 199 |
| 200 } // namespace storage | 200 } // namespace storage |
| 201 | 201 |
| 202 #endif // STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ | 202 #endif // STORAGE_BROWSER_QUOTA_USAGE_TRACKER_H_ |
| OLD | NEW |