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_QUOTA_MANAGER_H_ | 5 #ifndef WEBKIT_QUOTA_QUOTA_MANAGER_H_ |
6 #define WEBKIT_QUOTA_QUOTA_MANAGER_H_ | 6 #define WEBKIT_QUOTA_QUOTA_MANAGER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <deque> | 9 #include <deque> |
10 #include <list> | 10 #include <list> |
(...skipping 16 matching lines...) Expand all Loading... | |
27 class FilePath; | 27 class FilePath; |
28 | 28 |
29 namespace quota { | 29 namespace quota { |
30 | 30 |
31 class QuotaDatabase; | 31 class QuotaDatabase; |
32 class UsageTracker; | 32 class UsageTracker; |
33 | 33 |
34 struct QuotaManagerDeleter; | 34 struct QuotaManagerDeleter; |
35 class QuotaManagerProxy; | 35 class QuotaManagerProxy; |
36 | 36 |
37 // An interface called by QuotaTemporaryStorageEvictor. | |
38 class QuotaEvictionHandler { | |
39 public: | |
40 typedef Callback1<GURL>::Type GetLRUOriginCallback; | |
41 typedef Callback4<QuotaStatusCode, | |
42 int64 /* usage */, | |
43 int64 /* quota */, | |
44 int64 /* physical_avail */ >::Type DeleteOriginDataCallback; | |
kinuko
2011/05/16 13:57:44
This callback being used for GetUsageAndQuotaForEv
| |
45 | |
46 virtual void GetUsageAndQuotaForEviction( | |
47 DeleteOriginDataCallback* callback) = 0; | |
48 | |
49 virtual void DeleteOriginData( | |
50 const GURL& origin, | |
51 StorageType type, | |
52 DeleteOriginDataCallback* callback) = 0; | |
53 | |
54 virtual void GetLRUOrigin( | |
55 StorageType type, | |
56 GetLRUOriginCallback* callback) = 0; | |
57 }; | |
58 | |
37 // The quota manager class. This class is instantiated per profile and | 59 // The quota manager class. This class is instantiated per profile and |
38 // held by the profile. With the exception of the constructor and the | 60 // held by the profile. With the exception of the constructor and the |
39 // proxy() method, all methods should only be called on the IO thread. | 61 // proxy() method, all methods should only be called on the IO thread. |
40 class QuotaManager : public QuotaTaskObserver, | 62 class QuotaManager : public QuotaTaskObserver, |
63 public QuotaEvictionHandler, | |
41 public base::RefCountedThreadSafe< | 64 public base::RefCountedThreadSafe< |
42 QuotaManager, QuotaManagerDeleter> { | 65 QuotaManager, QuotaManagerDeleter> { |
43 public: | 66 public: |
44 typedef Callback3<QuotaStatusCode, | 67 typedef Callback3<QuotaStatusCode, |
45 int64 /* usage */, | 68 int64 /* usage */, |
46 int64 /* quota */>::Type GetUsageAndQuotaCallback; | 69 int64 /* quota */>::Type GetUsageAndQuotaCallback; |
47 typedef Callback2<QuotaStatusCode, | 70 typedef Callback2<QuotaStatusCode, |
48 int64 /* granted_quota */>::Type RequestQuotaCallback; | 71 int64 /* granted_quota */>::Type RequestQuotaCallback; |
49 typedef Callback1<GURL>::Type GetLRUOriginCallback; | 72 typedef Callback1<GURL>::Type GetLRUOriginCallback; |
50 | 73 |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 // when the first quota manager API is called. | 158 // when the first quota manager API is called. |
136 // Initialize must be called after all quota clients are added to the | 159 // Initialize must be called after all quota clients are added to the |
137 // manager by RegisterStorage. | 160 // manager by RegisterStorage. |
138 void LazyInitialize(); | 161 void LazyInitialize(); |
139 | 162 |
140 // Called by clients via proxy. | 163 // Called by clients via proxy. |
141 // Registers a quota client to the manager. | 164 // Registers a quota client to the manager. |
142 // The client must remain valid until OnQuotaManagerDestored is called. | 165 // The client must remain valid until OnQuotaManagerDestored is called. |
143 void RegisterClient(QuotaClient* client); | 166 void RegisterClient(QuotaClient* client); |
144 | 167 |
145 // TODO(dmikurube): Add a test for this method. | |
146 virtual void GetLRUOrigin( | 168 virtual void GetLRUOrigin( |
147 StorageType type, | 169 StorageType type, |
148 GetLRUOriginCallback* callback); | 170 GetLRUOriginCallback* callback) OVERRIDE; |
171 | |
kinuko
2011/05/16 13:57:44
style-nit: no empty lines between OVERRIDE methods
| |
172 virtual void GetUsageAndQuotaForEviction( | |
173 DeleteOriginDataCallback* callback) OVERRIDE; | |
174 | |
175 virtual void DeleteOriginData( | |
176 const GURL& origin, | |
177 StorageType type, | |
178 DeleteOriginDataCallback* callback) OVERRIDE; | |
149 | 179 |
150 UsageTracker* GetUsageTracker(StorageType type) const; | 180 UsageTracker* GetUsageTracker(StorageType type) const; |
151 | 181 |
152 void DidGetTemporaryGlobalQuota(int64 quota); | 182 void DidGetTemporaryGlobalQuota(int64 quota); |
153 | 183 |
154 void DeleteOnCorrectThread() const; | 184 void DeleteOnCorrectThread() const; |
155 | 185 |
156 const bool is_incognito_; | 186 const bool is_incognito_; |
157 const FilePath profile_path_; | 187 const FilePath profile_path_; |
158 | 188 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
214 QuotaManager* manager_; // only accessed on the io thread | 244 QuotaManager* manager_; // only accessed on the io thread |
215 scoped_refptr<base::MessageLoopProxy> io_thread_; | 245 scoped_refptr<base::MessageLoopProxy> io_thread_; |
216 | 246 |
217 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); | 247 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); |
218 }; | 248 }; |
219 | 249 |
220 | 250 |
221 } // namespace quota | 251 } // namespace quota |
222 | 252 |
223 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_ | 253 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_ |
OLD | NEW |