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_QUOTA_MANAGER_H_ | 5 #ifndef STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
6 #define STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 6 #define STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
7 | 7 |
| 8 #include <stdint.h> |
| 9 |
8 #include <deque> | 10 #include <deque> |
9 #include <list> | 11 #include <list> |
10 #include <map> | 12 #include <map> |
11 #include <set> | 13 #include <set> |
12 #include <string> | 14 #include <string> |
13 #include <utility> | 15 #include <utility> |
14 #include <vector> | 16 #include <vector> |
15 | 17 |
16 #include "base/basictypes.h" | |
17 #include "base/callback.h" | 18 #include "base/callback.h" |
18 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/macros.h" |
19 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
20 #include "base/memory/scoped_ptr.h" | 22 #include "base/memory/scoped_ptr.h" |
21 #include "base/memory/weak_ptr.h" | 23 #include "base/memory/weak_ptr.h" |
22 #include "base/sequenced_task_runner_helpers.h" | 24 #include "base/sequenced_task_runner_helpers.h" |
23 #include "storage/browser/quota/quota_callbacks.h" | 25 #include "storage/browser/quota/quota_callbacks.h" |
24 #include "storage/browser/quota/quota_client.h" | 26 #include "storage/browser/quota/quota_client.h" |
25 #include "storage/browser/quota/quota_database.h" | 27 #include "storage/browser/quota/quota_database.h" |
26 #include "storage/browser/quota/quota_task.h" | 28 #include "storage/browser/quota/quota_task.h" |
27 #include "storage/browser/quota/special_storage_policy.h" | 29 #include "storage/browser/quota/special_storage_policy.h" |
28 #include "storage/browser/quota/storage_observer.h" | 30 #include "storage/browser/quota/storage_observer.h" |
(...skipping 23 matching lines...) Expand all Loading... |
52 | 54 |
53 class QuotaDatabase; | 55 class QuotaDatabase; |
54 class QuotaManagerProxy; | 56 class QuotaManagerProxy; |
55 class QuotaTemporaryStorageEvictor; | 57 class QuotaTemporaryStorageEvictor; |
56 class StorageMonitor; | 58 class StorageMonitor; |
57 class UsageTracker; | 59 class UsageTracker; |
58 | 60 |
59 struct QuotaManagerDeleter; | 61 struct QuotaManagerDeleter; |
60 | 62 |
61 struct STORAGE_EXPORT UsageAndQuota { | 63 struct STORAGE_EXPORT UsageAndQuota { |
62 int64 usage; | 64 int64_t usage; |
63 int64 global_limited_usage; | 65 int64_t global_limited_usage; |
64 int64 quota; | 66 int64_t quota; |
65 int64 available_disk_space; | 67 int64_t available_disk_space; |
66 | 68 |
67 UsageAndQuota(); | 69 UsageAndQuota(); |
68 UsageAndQuota(int64 usage, | 70 UsageAndQuota(int64_t usage, |
69 int64 global_limited_usage, | 71 int64_t global_limited_usage, |
70 int64 quota, | 72 int64_t quota, |
71 int64 available_disk_space); | 73 int64_t available_disk_space); |
72 }; | 74 }; |
73 | 75 |
74 // TODO(calamity): Use this in the temporary storage eviction path. | 76 // TODO(calamity): Use this in the temporary storage eviction path. |
75 // An interface for deciding which origin's storage should be evicted when the | 77 // An interface for deciding which origin's storage should be evicted when the |
76 // quota is exceeded. | 78 // quota is exceeded. |
77 class STORAGE_EXPORT QuotaEvictionPolicy { | 79 class STORAGE_EXPORT QuotaEvictionPolicy { |
78 public: | 80 public: |
79 virtual ~QuotaEvictionPolicy() {} | 81 virtual ~QuotaEvictionPolicy() {} |
80 | 82 |
81 // Returns the next origin to evict. It might return an empty GURL when there | 83 // Returns the next origin to evict. It might return an empty GURL when there |
82 // are no evictable origins. | 84 // are no evictable origins. |
83 virtual void GetEvictionOrigin( | 85 virtual void GetEvictionOrigin( |
84 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy, | 86 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy, |
85 const std::set<GURL>& exceptions, | 87 const std::set<GURL>& exceptions, |
86 const std::map<GURL, int64>& usage_map, | 88 const std::map<GURL, int64_t>& usage_map, |
87 int64 global_quota, | 89 int64_t global_quota, |
88 const GetOriginCallback& callback) = 0; | 90 const GetOriginCallback& callback) = 0; |
89 }; | 91 }; |
90 | 92 |
91 // An interface called by QuotaTemporaryStorageEvictor. | 93 // An interface called by QuotaTemporaryStorageEvictor. |
92 class STORAGE_EXPORT QuotaEvictionHandler { | 94 class STORAGE_EXPORT QuotaEvictionHandler { |
93 public: | 95 public: |
94 typedef StatusCallback EvictOriginDataCallback; | 96 typedef StatusCallback EvictOriginDataCallback; |
95 typedef base::Callback<void(QuotaStatusCode status, | 97 typedef base::Callback<void(QuotaStatusCode status, |
96 const UsageAndQuota& usage_and_quota)> | 98 const UsageAndQuota& usage_and_quota)> |
97 UsageAndQuotaCallback; | 99 UsageAndQuotaCallback; |
98 | 100 |
99 // Returns next origin to evict. It might return an empty GURL when there are | 101 // Returns next origin to evict. It might return an empty GURL when there are |
100 // no evictable origins. | 102 // no evictable origins. |
101 virtual void GetEvictionOrigin(StorageType type, | 103 virtual void GetEvictionOrigin(StorageType type, |
102 const std::set<GURL>& extra_exceptions, | 104 const std::set<GURL>& extra_exceptions, |
103 int64 global_quota, | 105 int64_t global_quota, |
104 const GetOriginCallback& callback) = 0; | 106 const GetOriginCallback& callback) = 0; |
105 | 107 |
106 virtual void EvictOriginData( | 108 virtual void EvictOriginData( |
107 const GURL& origin, | 109 const GURL& origin, |
108 StorageType type, | 110 StorageType type, |
109 const EvictOriginDataCallback& callback) = 0; | 111 const EvictOriginDataCallback& callback) = 0; |
110 | 112 |
111 virtual void GetUsageAndQuotaForEviction( | 113 virtual void GetUsageAndQuotaForEviction( |
112 const UsageAndQuotaCallback& callback) = 0; | 114 const UsageAndQuotaCallback& callback) = 0; |
113 | 115 |
114 protected: | 116 protected: |
115 virtual ~QuotaEvictionHandler() {} | 117 virtual ~QuotaEvictionHandler() {} |
116 }; | 118 }; |
117 | 119 |
118 struct UsageInfo { | 120 struct UsageInfo { |
119 UsageInfo(const std::string& host, StorageType type, int64 usage) | 121 UsageInfo(const std::string& host, StorageType type, int64_t usage) |
120 : host(host), | 122 : host(host), type(type), usage(usage) {} |
121 type(type), | |
122 usage(usage) {} | |
123 std::string host; | 123 std::string host; |
124 StorageType type; | 124 StorageType type; |
125 int64 usage; | 125 int64_t usage; |
126 }; | 126 }; |
127 | 127 |
128 // The quota manager class. This class is instantiated per profile and | 128 // The quota manager class. This class is instantiated per profile and |
129 // held by the profile. With the exception of the constructor and the | 129 // held by the profile. With the exception of the constructor and the |
130 // proxy() method, all methods should only be called on the IO thread. | 130 // proxy() method, all methods should only be called on the IO thread. |
131 class STORAGE_EXPORT QuotaManager | 131 class STORAGE_EXPORT QuotaManager |
132 : public QuotaTaskObserver, | 132 : public QuotaTaskObserver, |
133 public QuotaEvictionHandler, | 133 public QuotaEvictionHandler, |
134 public base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter> { | 134 public base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter> { |
135 public: | 135 public: |
136 typedef base::Callback<void(QuotaStatusCode, | 136 typedef base::Callback<void(QuotaStatusCode, |
137 int64 /* usage */, | 137 int64_t /* usage */, |
138 int64 /* quota */)> | 138 int64_t /* quota */)> GetUsageAndQuotaCallback; |
139 GetUsageAndQuotaCallback; | |
140 | 139 |
141 static const int64 kIncognitoDefaultQuotaLimit; | 140 static const int64_t kIncognitoDefaultQuotaLimit; |
142 static const int64 kNoLimit; | 141 static const int64_t kNoLimit; |
143 | 142 |
144 QuotaManager( | 143 QuotaManager( |
145 bool is_incognito, | 144 bool is_incognito, |
146 const base::FilePath& profile_path, | 145 const base::FilePath& profile_path, |
147 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, | 146 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, |
148 const scoped_refptr<base::SequencedTaskRunner>& db_thread, | 147 const scoped_refptr<base::SequencedTaskRunner>& db_thread, |
149 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy); | 148 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy); |
150 | 149 |
151 // Returns a proxy object that can be used on any thread. | 150 // Returns a proxy object that can be used on any thread. |
152 QuotaManagerProxy* proxy() { return proxy_.get(); } | 151 QuotaManagerProxy* proxy() { return proxy_.get(); } |
(...skipping 25 matching lines...) Expand all Loading... |
178 void NotifyStorageAccessed(QuotaClient::ID client_id, | 177 void NotifyStorageAccessed(QuotaClient::ID client_id, |
179 const GURL& origin, | 178 const GURL& origin, |
180 StorageType type); | 179 StorageType type); |
181 | 180 |
182 // Called by clients via proxy. | 181 // Called by clients via proxy. |
183 // Client storage must call this method whenever they have made any | 182 // Client storage must call this method whenever they have made any |
184 // modifications that change the amount of data stored in their storage. | 183 // modifications that change the amount of data stored in their storage. |
185 void NotifyStorageModified(QuotaClient::ID client_id, | 184 void NotifyStorageModified(QuotaClient::ID client_id, |
186 const GURL& origin, | 185 const GURL& origin, |
187 StorageType type, | 186 StorageType type, |
188 int64 delta); | 187 int64_t delta); |
189 | 188 |
190 // Used to avoid evicting origins with open pages. | 189 // Used to avoid evicting origins with open pages. |
191 // A call to NotifyOriginInUse must be balanced by a later call | 190 // A call to NotifyOriginInUse must be balanced by a later call |
192 // to NotifyOriginNoLongerInUse. | 191 // to NotifyOriginNoLongerInUse. |
193 void NotifyOriginInUse(const GURL& origin); | 192 void NotifyOriginInUse(const GURL& origin); |
194 void NotifyOriginNoLongerInUse(const GURL& origin); | 193 void NotifyOriginNoLongerInUse(const GURL& origin); |
195 bool IsOriginInUse(const GURL& origin) const { | 194 bool IsOriginInUse(const GURL& origin) const { |
196 return origins_in_use_.find(origin) != origins_in_use_.end(); | 195 return origins_in_use_.find(origin) != origins_in_use_.end(); |
197 } | 196 } |
198 | 197 |
(...skipping 20 matching lines...) Expand all Loading... |
219 void DeleteHostData(const std::string& host, | 218 void DeleteHostData(const std::string& host, |
220 StorageType type, | 219 StorageType type, |
221 int quota_client_mask, | 220 int quota_client_mask, |
222 const StatusCallback& callback); | 221 const StatusCallback& callback); |
223 | 222 |
224 // Called by UI and internal modules. | 223 // Called by UI and internal modules. |
225 void GetAvailableSpace(const AvailableSpaceCallback& callback); | 224 void GetAvailableSpace(const AvailableSpaceCallback& callback); |
226 void GetTemporaryGlobalQuota(const QuotaCallback& callback); | 225 void GetTemporaryGlobalQuota(const QuotaCallback& callback); |
227 | 226 |
228 // Ok to call with NULL callback. | 227 // Ok to call with NULL callback. |
229 void SetTemporaryGlobalOverrideQuota(int64 new_quota, | 228 void SetTemporaryGlobalOverrideQuota(int64_t new_quota, |
230 const QuotaCallback& callback); | 229 const QuotaCallback& callback); |
231 | 230 |
232 void GetPersistentHostQuota(const std::string& host, | 231 void GetPersistentHostQuota(const std::string& host, |
233 const QuotaCallback& callback); | 232 const QuotaCallback& callback); |
234 void SetPersistentHostQuota(const std::string& host, | 233 void SetPersistentHostQuota(const std::string& host, |
235 int64 new_quota, | 234 int64_t new_quota, |
236 const QuotaCallback& callback); | 235 const QuotaCallback& callback); |
237 void GetGlobalUsage(StorageType type, const GlobalUsageCallback& callback); | 236 void GetGlobalUsage(StorageType type, const GlobalUsageCallback& callback); |
238 void GetHostUsage(const std::string& host, StorageType type, | 237 void GetHostUsage(const std::string& host, StorageType type, |
239 const UsageCallback& callback); | 238 const UsageCallback& callback); |
240 void GetHostUsage(const std::string& host, StorageType type, | 239 void GetHostUsage(const std::string& host, StorageType type, |
241 QuotaClient::ID client_id, | 240 QuotaClient::ID client_id, |
242 const UsageCallback& callback); | 241 const UsageCallback& callback); |
243 | 242 |
244 bool IsTrackingHostUsage(StorageType type, QuotaClient::ID client_id) const; | 243 bool IsTrackingHostUsage(StorageType type, QuotaClient::ID client_id) const; |
245 | 244 |
(...skipping 16 matching lines...) Expand all Loading... |
262 void AddStorageObserver(StorageObserver* observer, | 261 void AddStorageObserver(StorageObserver* observer, |
263 const StorageObserver::MonitorParams& params); | 262 const StorageObserver::MonitorParams& params); |
264 void RemoveStorageObserver(StorageObserver* observer); | 263 void RemoveStorageObserver(StorageObserver* observer); |
265 void RemoveStorageObserverForFilter(StorageObserver* observer, | 264 void RemoveStorageObserverForFilter(StorageObserver* observer, |
266 const StorageObserver::Filter& filter); | 265 const StorageObserver::Filter& filter); |
267 | 266 |
268 // Determines the portion of the temp pool that can be | 267 // Determines the portion of the temp pool that can be |
269 // utilized by a single host (ie. 5 for 20%). | 268 // utilized by a single host (ie. 5 for 20%). |
270 static const int kPerHostTemporaryPortion; | 269 static const int kPerHostTemporaryPortion; |
271 | 270 |
272 static const int64 kPerHostPersistentQuotaLimit; | 271 static const int64_t kPerHostPersistentQuotaLimit; |
273 | 272 |
274 static const char kDatabaseName[]; | 273 static const char kDatabaseName[]; |
275 | 274 |
276 static const int kThresholdOfErrorsToBeBlacklisted; | 275 static const int kThresholdOfErrorsToBeBlacklisted; |
277 | 276 |
278 static const int kEvictionIntervalInMilliSeconds; | 277 static const int kEvictionIntervalInMilliSeconds; |
279 | 278 |
280 static const char kTimeBetweenRepeatedOriginEvictionsHistogram[]; | 279 static const char kTimeBetweenRepeatedOriginEvictionsHistogram[]; |
281 static const char kEvictedOriginAccessedCountHistogram[]; | 280 static const char kEvictedOriginAccessedCountHistogram[]; |
282 static const char kEvictedOriginTimeSinceAccessHistogram[]; | 281 static const char kEvictedOriginTimeSinceAccessHistogram[]; |
283 | 282 |
284 // These are kept non-const so that test code can change the value. | 283 // These are kept non-const so that test code can change the value. |
285 // TODO(kinuko): Make this a real const value and add a proper way to set | 284 // TODO(kinuko): Make this a real const value and add a proper way to set |
286 // the quota for syncable storage. (http://crbug.com/155488) | 285 // the quota for syncable storage. (http://crbug.com/155488) |
287 static int64 kMinimumPreserveForSystem; | 286 static int64_t kMinimumPreserveForSystem; |
288 static int64 kSyncableStorageDefaultHostQuota; | 287 static int64_t kSyncableStorageDefaultHostQuota; |
289 | 288 |
290 protected: | 289 protected: |
291 ~QuotaManager() override; | 290 ~QuotaManager() override; |
292 | 291 |
293 private: | 292 private: |
294 friend class base::DeleteHelper<QuotaManager>; | 293 friend class base::DeleteHelper<QuotaManager>; |
295 friend class base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter>; | 294 friend class base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter>; |
296 friend class content::QuotaManagerTest; | 295 friend class content::QuotaManagerTest; |
297 friend class content::StorageMonitorTest; | 296 friend class content::StorageMonitorTest; |
298 friend class content::MockQuotaManager; | 297 friend class content::MockQuotaManager; |
(...skipping 13 matching lines...) Expand all Loading... |
312 class DumpQuotaTableHelper; | 311 class DumpQuotaTableHelper; |
313 class DumpOriginInfoTableHelper; | 312 class DumpOriginInfoTableHelper; |
314 | 313 |
315 typedef QuotaDatabase::QuotaTableEntry QuotaTableEntry; | 314 typedef QuotaDatabase::QuotaTableEntry QuotaTableEntry; |
316 typedef QuotaDatabase::OriginInfoTableEntry OriginInfoTableEntry; | 315 typedef QuotaDatabase::OriginInfoTableEntry OriginInfoTableEntry; |
317 typedef std::vector<QuotaTableEntry> QuotaTableEntries; | 316 typedef std::vector<QuotaTableEntry> QuotaTableEntries; |
318 typedef std::vector<OriginInfoTableEntry> OriginInfoTableEntries; | 317 typedef std::vector<OriginInfoTableEntry> OriginInfoTableEntries; |
319 | 318 |
320 // Function pointer type used to store the function which returns the | 319 // Function pointer type used to store the function which returns the |
321 // available disk space for the disk containing the given FilePath. | 320 // available disk space for the disk containing the given FilePath. |
322 typedef int64 (*GetAvailableDiskSpaceFn)(const base::FilePath&); | 321 typedef int64_t (*GetAvailableDiskSpaceFn)(const base::FilePath&); |
323 | 322 |
324 typedef base::Callback<void(const QuotaTableEntries&)> | 323 typedef base::Callback<void(const QuotaTableEntries&)> |
325 DumpQuotaTableCallback; | 324 DumpQuotaTableCallback; |
326 typedef base::Callback<void(const OriginInfoTableEntries&)> | 325 typedef base::Callback<void(const OriginInfoTableEntries&)> |
327 DumpOriginInfoTableCallback; | 326 DumpOriginInfoTableCallback; |
328 | 327 |
329 typedef CallbackQueue<base::Closure> ClosureQueue; | 328 typedef CallbackQueue<base::Closure> ClosureQueue; |
330 typedef CallbackQueue<AvailableSpaceCallback, QuotaStatusCode, int64> | 329 typedef CallbackQueue<AvailableSpaceCallback, QuotaStatusCode, int64_t> |
331 AvailableSpaceCallbackQueue; | 330 AvailableSpaceCallbackQueue; |
332 typedef CallbackQueueMap<QuotaCallback, std::string, QuotaStatusCode, int64> | 331 typedef CallbackQueueMap<QuotaCallback, std::string, QuotaStatusCode, int64_t> |
333 HostQuotaCallbackMap; | 332 HostQuotaCallbackMap; |
334 | 333 |
335 struct EvictionContext { | 334 struct EvictionContext { |
336 EvictionContext(); | 335 EvictionContext(); |
337 virtual ~EvictionContext(); | 336 virtual ~EvictionContext(); |
338 GURL evicted_origin; | 337 GURL evicted_origin; |
339 StorageType evicted_type; | 338 StorageType evicted_type; |
340 | 339 |
341 EvictOriginDataCallback evict_origin_data_callback; | 340 EvictOriginDataCallback evict_origin_data_callback; |
342 }; | 341 }; |
(...skipping 17 matching lines...) Expand all Loading... |
360 // Extract cached origins list from the usage tracker. | 359 // Extract cached origins list from the usage tracker. |
361 // (Might return empty list if no origin is tracked by the tracker.) | 360 // (Might return empty list if no origin is tracked by the tracker.) |
362 void GetCachedOrigins(StorageType type, std::set<GURL>* origins); | 361 void GetCachedOrigins(StorageType type, std::set<GURL>* origins); |
363 | 362 |
364 // These internal methods are separately defined mainly for testing. | 363 // These internal methods are separately defined mainly for testing. |
365 void NotifyStorageAccessedInternal( | 364 void NotifyStorageAccessedInternal( |
366 QuotaClient::ID client_id, | 365 QuotaClient::ID client_id, |
367 const GURL& origin, | 366 const GURL& origin, |
368 StorageType type, | 367 StorageType type, |
369 base::Time accessed_time); | 368 base::Time accessed_time); |
370 void NotifyStorageModifiedInternal( | 369 void NotifyStorageModifiedInternal(QuotaClient::ID client_id, |
371 QuotaClient::ID client_id, | 370 const GURL& origin, |
372 const GURL& origin, | 371 StorageType type, |
373 StorageType type, | 372 int64_t delta, |
374 int64 delta, | 373 base::Time modified_time); |
375 base::Time modified_time); | |
376 | 374 |
377 void DumpQuotaTable(const DumpQuotaTableCallback& callback); | 375 void DumpQuotaTable(const DumpQuotaTableCallback& callback); |
378 void DumpOriginInfoTable(const DumpOriginInfoTableCallback& callback); | 376 void DumpOriginInfoTable(const DumpOriginInfoTableCallback& callback); |
379 | 377 |
380 void DeleteOriginDataInternal(const GURL& origin, | 378 void DeleteOriginDataInternal(const GURL& origin, |
381 StorageType type, | 379 StorageType type, |
382 int quota_client_mask, | 380 int quota_client_mask, |
383 bool is_eviction, | 381 bool is_eviction, |
384 const StatusCallback& callback); | 382 const StatusCallback& callback); |
385 | 383 |
386 // Methods for eviction logic. | 384 // Methods for eviction logic. |
387 void StartEviction(); | 385 void StartEviction(); |
388 void DeleteOriginFromDatabase(const GURL& origin, | 386 void DeleteOriginFromDatabase(const GURL& origin, |
389 StorageType type, | 387 StorageType type, |
390 bool is_eviction); | 388 bool is_eviction); |
391 | 389 |
392 void DidOriginDataEvicted(QuotaStatusCode status); | 390 void DidOriginDataEvicted(QuotaStatusCode status); |
393 | 391 |
394 void ReportHistogram(); | 392 void ReportHistogram(); |
395 void DidGetTemporaryGlobalUsageForHistogram(int64 usage, | 393 void DidGetTemporaryGlobalUsageForHistogram(int64_t usage, |
396 int64 unlimited_usage); | 394 int64_t unlimited_usage); |
397 void DidGetPersistentGlobalUsageForHistogram(int64 usage, | 395 void DidGetPersistentGlobalUsageForHistogram(int64_t usage, |
398 int64 unlimited_usage); | 396 int64_t unlimited_usage); |
399 | 397 |
400 std::set<GURL> GetEvictionOriginExceptions( | 398 std::set<GURL> GetEvictionOriginExceptions( |
401 const std::set<GURL>& extra_exceptions); | 399 const std::set<GURL>& extra_exceptions); |
402 void DidGetEvictionOrigin(const GetOriginCallback& callback, | 400 void DidGetEvictionOrigin(const GetOriginCallback& callback, |
403 const GURL& origin); | 401 const GURL& origin); |
404 | 402 |
405 // QuotaEvictionHandler. | 403 // QuotaEvictionHandler. |
406 void GetEvictionOrigin(StorageType type, | 404 void GetEvictionOrigin(StorageType type, |
407 const std::set<GURL>& extra_exceptions, | 405 const std::set<GURL>& extra_exceptions, |
408 int64 global_quota, | 406 int64_t global_quota, |
409 const GetOriginCallback& callback) override; | 407 const GetOriginCallback& callback) override; |
410 void EvictOriginData(const GURL& origin, | 408 void EvictOriginData(const GURL& origin, |
411 StorageType type, | 409 StorageType type, |
412 const EvictOriginDataCallback& callback) override; | 410 const EvictOriginDataCallback& callback) override; |
413 void GetUsageAndQuotaForEviction( | 411 void GetUsageAndQuotaForEviction( |
414 const UsageAndQuotaCallback& callback) override; | 412 const UsageAndQuotaCallback& callback) override; |
415 | 413 |
416 void GetLRUOrigin(StorageType type, const GetOriginCallback& callback); | 414 void GetLRUOrigin(StorageType type, const GetOriginCallback& callback); |
417 | 415 |
418 void DidSetTemporaryGlobalOverrideQuota(const QuotaCallback& callback, | 416 void DidSetTemporaryGlobalOverrideQuota(const QuotaCallback& callback, |
419 const int64* new_quota, | 417 const int64_t* new_quota, |
420 bool success); | 418 bool success); |
421 void DidGetPersistentHostQuota(const std::string& host, | 419 void DidGetPersistentHostQuota(const std::string& host, |
422 const int64* quota, | 420 const int64_t* quota, |
423 bool success); | 421 bool success); |
424 void DidSetPersistentHostQuota(const std::string& host, | 422 void DidSetPersistentHostQuota(const std::string& host, |
425 const QuotaCallback& callback, | 423 const QuotaCallback& callback, |
426 const int64* new_quota, | 424 const int64_t* new_quota, |
427 bool success); | 425 bool success); |
428 void DidInitialize(int64* temporary_quota_override, | 426 void DidInitialize(int64_t* temporary_quota_override, |
429 int64* desired_available_space, | 427 int64_t* desired_available_space, |
430 bool success); | 428 bool success); |
431 void DidGetLRUOrigin(const GURL* origin, | 429 void DidGetLRUOrigin(const GURL* origin, |
432 bool success); | 430 bool success); |
433 void DidGetInitialTemporaryGlobalQuota(QuotaStatusCode status, | 431 void DidGetInitialTemporaryGlobalQuota(QuotaStatusCode status, |
434 int64 quota_unused); | 432 int64_t quota_unused); |
435 void DidInitializeTemporaryOriginsInfo(bool success); | 433 void DidInitializeTemporaryOriginsInfo(bool success); |
436 void DidGetAvailableSpace(int64 space); | 434 void DidGetAvailableSpace(int64_t space); |
437 void DidDatabaseWork(bool success); | 435 void DidDatabaseWork(bool success); |
438 | 436 |
439 void DeleteOnCorrectThread() const; | 437 void DeleteOnCorrectThread() const; |
440 | 438 |
441 void PostTaskAndReplyWithResultForDBThread( | 439 void PostTaskAndReplyWithResultForDBThread( |
442 const tracked_objects::Location& from_here, | 440 const tracked_objects::Location& from_here, |
443 const base::Callback<bool(QuotaDatabase*)>& task, | 441 const base::Callback<bool(QuotaDatabase*)>& task, |
444 const base::Callback<void(bool)>& reply); | 442 const base::Callback<void(bool)>& reply); |
445 | 443 |
446 const bool is_incognito_; | 444 const bool is_incognito_; |
(...skipping 20 matching lines...) Expand all Loading... |
467 scoped_ptr<QuotaTemporaryStorageEvictor> temporary_storage_evictor_; | 465 scoped_ptr<QuotaTemporaryStorageEvictor> temporary_storage_evictor_; |
468 EvictionContext eviction_context_; | 466 EvictionContext eviction_context_; |
469 scoped_ptr<QuotaEvictionPolicy> temporary_storage_eviction_policy_; | 467 scoped_ptr<QuotaEvictionPolicy> temporary_storage_eviction_policy_; |
470 bool is_getting_eviction_origin_; | 468 bool is_getting_eviction_origin_; |
471 | 469 |
472 ClosureQueue db_initialization_callbacks_; | 470 ClosureQueue db_initialization_callbacks_; |
473 AvailableSpaceCallbackQueue available_space_callbacks_; | 471 AvailableSpaceCallbackQueue available_space_callbacks_; |
474 HostQuotaCallbackMap persistent_host_quota_callbacks_; | 472 HostQuotaCallbackMap persistent_host_quota_callbacks_; |
475 | 473 |
476 bool temporary_quota_initialized_; | 474 bool temporary_quota_initialized_; |
477 int64 temporary_quota_override_; | 475 int64_t temporary_quota_override_; |
478 | 476 |
479 int64 desired_available_space_; | 477 int64_t desired_available_space_; |
480 | 478 |
481 // Map from origin to count. | 479 // Map from origin to count. |
482 std::map<GURL, int> origins_in_use_; | 480 std::map<GURL, int> origins_in_use_; |
483 // Map from origin to error count. | 481 // Map from origin to error count. |
484 std::map<GURL, int> origins_in_error_; | 482 std::map<GURL, int> origins_in_error_; |
485 | 483 |
486 scoped_refptr<SpecialStoragePolicy> special_storage_policy_; | 484 scoped_refptr<SpecialStoragePolicy> special_storage_policy_; |
487 | 485 |
488 base::RepeatingTimer histogram_timer_; | 486 base::RepeatingTimer histogram_timer_; |
489 | 487 |
(...skipping 11 matching lines...) Expand all Loading... |
501 | 499 |
502 struct QuotaManagerDeleter { | 500 struct QuotaManagerDeleter { |
503 static void Destruct(const QuotaManager* manager) { | 501 static void Destruct(const QuotaManager* manager) { |
504 manager->DeleteOnCorrectThread(); | 502 manager->DeleteOnCorrectThread(); |
505 } | 503 } |
506 }; | 504 }; |
507 | 505 |
508 } // namespace storage | 506 } // namespace storage |
509 | 507 |
510 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 508 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
OLD | NEW |