| 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 #ifndef WEBKIT_QUOTA_USAGE_TRACKER_H_ | 5 #ifndef WEBKIT_QUOTA_USAGE_TRACKER_H_ |
| 6 #define WEBKIT_QUOTA_USAGE_TRACKER_H_ | 6 #define WEBKIT_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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 // Methods used by our GatherUsage tasks, as a task makes progress | 107 // Methods used by our GatherUsage tasks, as a task makes progress |
| 108 // origins and hosts are added incrementally to the cache. | 108 // origins and hosts are added incrementally to the cache. |
| 109 void AddCachedOrigin(const GURL& origin, int64 usage); | 109 void AddCachedOrigin(const GURL& origin, int64 usage); |
| 110 void AddCachedHost(const std::string& host); | 110 void AddCachedHost(const std::string& host); |
| 111 void GatherGlobalUsageComplete(); | 111 void GatherGlobalUsageComplete(); |
| 112 void GatherHostUsageComplete(const std::string& host); | 112 void GatherHostUsageComplete(const std::string& host); |
| 113 | 113 |
| 114 int64 GetCachedHostUsage(const std::string& host) const; | 114 int64 GetCachedHostUsage(const std::string& host) const; |
| 115 int64 GetCachedGlobalUnlimitedUsage(); | 115 int64 GetCachedGlobalUnlimitedUsage(); |
| 116 virtual void OnSpecialStoragePolicyChanged() OVERRIDE; | 116 virtual void OnSpecialStoragePolicyChanged() OVERRIDE; |
| 117 void NoopHostUsageCallback( | 117 void NoopHostUsageCallback(int64 usage); |
| 118 const std::string& host, StorageType type, int64 usage); | |
| 119 bool IsStorageUnlimited(const GURL& origin) const; | 118 bool IsStorageUnlimited(const GURL& origin) const; |
| 120 | 119 |
| 121 UsageTracker* tracker_; | 120 UsageTracker* tracker_; |
| 122 QuotaClient* client_; | 121 QuotaClient* client_; |
| 123 const StorageType type_; | 122 const StorageType type_; |
| 124 | 123 |
| 125 int64 global_usage_; | 124 int64 global_usage_; |
| 126 int64 global_unlimited_usage_; | 125 int64 global_unlimited_usage_; |
| 127 bool global_usage_retrieved_; | 126 bool global_usage_retrieved_; |
| 128 bool global_unlimited_usage_is_valid_; | 127 bool global_unlimited_usage_is_valid_; |
| 129 HostSet cached_hosts_; | 128 HostSet cached_hosts_; |
| 130 HostUsageMap cached_usage_; | 129 HostUsageMap cached_usage_; |
| 131 | 130 |
| 132 GatherGlobalUsageTask* global_usage_task_; | 131 GatherGlobalUsageTask* global_usage_task_; |
| 133 GlobalUsageCallbackQueue global_usage_callback_; | 132 GlobalUsageCallbackQueue global_usage_callback_; |
| 134 std::map<std::string, GatherHostUsageTask*> host_usage_tasks_; | 133 std::map<std::string, GatherHostUsageTask*> host_usage_tasks_; |
| 135 HostUsageCallbackMap host_usage_callbacks_; | 134 HostUsageCallbackMap host_usage_callbacks_; |
| 136 | 135 |
| 137 scoped_refptr<SpecialStoragePolicy> special_storage_policy_; | 136 scoped_refptr<SpecialStoragePolicy> special_storage_policy_; |
| 138 | 137 |
| 139 DISALLOW_COPY_AND_ASSIGN(ClientUsageTracker); | 138 DISALLOW_COPY_AND_ASSIGN(ClientUsageTracker); |
| 140 }; | 139 }; |
| 141 | 140 |
| 142 } // namespace quota | 141 } // namespace quota |
| 143 | 142 |
| 144 #endif // WEBKIT_QUOTA_USAGE_TRACKER_H_ | 143 #endif // WEBKIT_QUOTA_USAGE_TRACKER_H_ |
| OLD | NEW |