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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace quota { | 21 namespace quota { |
22 | 22 |
23 class ClientUsageTracker; | 23 class ClientUsageTracker; |
24 | 24 |
25 // A helper class that gathers and tracks the amount of data stored in | 25 // A helper class that gathers and tracks the amount of data stored in |
26 // all quota clients. | 26 // all quota clients. |
27 // An instance of this class is created per storage type. | 27 // An instance of this class is created per storage type. |
28 class UsageTracker : public QuotaTaskObserver { | 28 class UsageTracker : public QuotaTaskObserver { |
29 public: | 29 public: |
30 UsageTracker(const QuotaClientList& clients, StorageType type); | 30 UsageTracker(const QuotaClientList& clients, StorageType type); |
31 ~UsageTracker(); | 31 virtual ~UsageTracker(); |
32 | 32 |
33 StorageType type() const { return type_; } | 33 StorageType type() const { return type_; } |
34 ClientUsageTracker* GetClientTracker(QuotaClient::ID client_id); | 34 ClientUsageTracker* GetClientTracker(QuotaClient::ID client_id); |
35 | 35 |
36 void GetGlobalUsage(UsageCallback* callback); | 36 void GetGlobalUsage(UsageCallback* callback); |
37 void GetHostUsage(const std::string& host, HostUsageCallback* callback); | 37 void GetHostUsage(const std::string& host, HostUsageCallback* callback); |
38 void UpdateUsageCache(QuotaClient::ID client_id, | 38 void UpdateUsageCache(QuotaClient::ID client_id, |
39 const GURL& origin, | 39 const GURL& origin, |
40 int64 delta); | 40 int64 delta); |
41 | 41 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 std::map<std::string, int64> host_usage_map_; | 102 std::map<std::string, int64> host_usage_map_; |
103 std::map<std::string, GatherHostUsageTask*> host_usage_tasks_; | 103 std::map<std::string, GatherHostUsageTask*> host_usage_tasks_; |
104 HostUsageCallbackMap host_usage_callbacks_; | 104 HostUsageCallbackMap host_usage_callbacks_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(ClientUsageTracker); | 106 DISALLOW_COPY_AND_ASSIGN(ClientUsageTracker); |
107 }; | 107 }; |
108 | 108 |
109 } // namespace quota | 109 } // namespace quota |
110 | 110 |
111 #endif // WEBKIT_QUOTA_USAGE_TRACKER_H_ | 111 #endif // WEBKIT_QUOTA_USAGE_TRACKER_H_ |
OLD | NEW |