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> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 const GetOriginCallback& callback) = 0; | 90 const GetOriginCallback& callback) = 0; |
91 }; | 91 }; |
92 | 92 |
93 // An interface called by QuotaTemporaryStorageEvictor. | 93 // An interface called by QuotaTemporaryStorageEvictor. |
94 class STORAGE_EXPORT QuotaEvictionHandler { | 94 class STORAGE_EXPORT QuotaEvictionHandler { |
95 public: | 95 public: |
96 using EvictOriginDataCallback = StatusCallback; | 96 using EvictOriginDataCallback = StatusCallback; |
97 using UsageAndQuotaCallback = base::Callback< | 97 using UsageAndQuotaCallback = base::Callback< |
98 void(QuotaStatusCode status, const UsageAndQuota& usage_and_quota)>; | 98 void(QuotaStatusCode status, const UsageAndQuota& usage_and_quota)>; |
99 using VolumeInfoCallback = base::Callback< | 99 using VolumeInfoCallback = base::Callback< |
100 void(bool success, uint64_t available_space, uint64_t total_space)>; | 100 void(bool success, int64_t available_space, int64_t total_space)>; |
101 | 101 |
102 // Returns next origin to evict. It might return an empty GURL when there are | 102 // Returns next origin to evict. It might return an empty GURL when there are |
103 // no evictable origins. | 103 // no evictable origins. |
104 virtual void GetEvictionOrigin(StorageType type, | 104 virtual void GetEvictionOrigin(StorageType type, |
105 const std::set<GURL>& extra_exceptions, | 105 const std::set<GURL>& extra_exceptions, |
106 int64_t global_quota, | 106 int64_t global_quota, |
107 const GetOriginCallback& callback) = 0; | 107 const GetOriginCallback& callback) = 0; |
108 | 108 |
109 virtual void EvictOriginData( | 109 virtual void EvictOriginData( |
110 const GURL& origin, | 110 const GURL& origin, |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 class DumpOriginInfoTableHelper; | 314 class DumpOriginInfoTableHelper; |
315 | 315 |
316 typedef QuotaDatabase::QuotaTableEntry QuotaTableEntry; | 316 typedef QuotaDatabase::QuotaTableEntry QuotaTableEntry; |
317 typedef QuotaDatabase::OriginInfoTableEntry OriginInfoTableEntry; | 317 typedef QuotaDatabase::OriginInfoTableEntry OriginInfoTableEntry; |
318 typedef std::vector<QuotaTableEntry> QuotaTableEntries; | 318 typedef std::vector<QuotaTableEntry> QuotaTableEntries; |
319 typedef std::vector<OriginInfoTableEntry> OriginInfoTableEntries; | 319 typedef std::vector<OriginInfoTableEntry> OriginInfoTableEntries; |
320 | 320 |
321 // Function pointer type used to store the function which returns | 321 // Function pointer type used to store the function which returns |
322 // information about the volume containing the given FilePath. | 322 // information about the volume containing the given FilePath. |
323 using GetVolumeInfoFn = bool(*)(const base::FilePath&, | 323 using GetVolumeInfoFn = bool(*)(const base::FilePath&, |
324 uint64_t* available, uint64_t* total); | 324 int64_t* available, int64_t* total); |
325 | 325 |
326 typedef base::Callback<void(const QuotaTableEntries&)> | 326 typedef base::Callback<void(const QuotaTableEntries&)> |
327 DumpQuotaTableCallback; | 327 DumpQuotaTableCallback; |
328 typedef base::Callback<void(const OriginInfoTableEntries&)> | 328 typedef base::Callback<void(const OriginInfoTableEntries&)> |
329 DumpOriginInfoTableCallback; | 329 DumpOriginInfoTableCallback; |
330 | 330 |
331 typedef CallbackQueue<base::Closure> ClosureQueue; | 331 typedef CallbackQueue<base::Closure> ClosureQueue; |
332 typedef CallbackQueue<AvailableSpaceCallback, QuotaStatusCode, int64_t> | 332 typedef CallbackQueue<AvailableSpaceCallback, QuotaStatusCode, int64_t> |
333 AvailableSpaceCallbackQueue; | 333 AvailableSpaceCallbackQueue; |
334 typedef CallbackQueueMap<QuotaCallback, std::string, QuotaStatusCode, int64_t> | 334 typedef CallbackQueueMap<QuotaCallback, std::string, QuotaStatusCode, int64_t> |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 const GetOriginCallback& callback) override; | 412 const GetOriginCallback& callback) override; |
413 void EvictOriginData(const GURL& origin, | 413 void EvictOriginData(const GURL& origin, |
414 StorageType type, | 414 StorageType type, |
415 const EvictOriginDataCallback& callback) override; | 415 const EvictOriginDataCallback& callback) override; |
416 void GetUsageAndQuotaForEviction( | 416 void GetUsageAndQuotaForEviction( |
417 const UsageAndQuotaCallback& callback) override; | 417 const UsageAndQuotaCallback& callback) override; |
418 void AsyncGetVolumeInfo(const VolumeInfoCallback& callback) override; | 418 void AsyncGetVolumeInfo(const VolumeInfoCallback& callback) override; |
419 | 419 |
420 void DidGetVolumeInfo( | 420 void DidGetVolumeInfo( |
421 const VolumeInfoCallback& callback, | 421 const VolumeInfoCallback& callback, |
422 uint64_t* available_space, uint64_t* total_space, bool success); | 422 int64_t* available_space, int64_t* total_space, bool success); |
423 | 423 |
424 void GetLRUOrigin(StorageType type, const GetOriginCallback& callback); | 424 void GetLRUOrigin(StorageType type, const GetOriginCallback& callback); |
425 | 425 |
426 void DidSetTemporaryGlobalOverrideQuota(const QuotaCallback& callback, | 426 void DidSetTemporaryGlobalOverrideQuota(const QuotaCallback& callback, |
427 const int64_t* new_quota, | 427 const int64_t* new_quota, |
428 bool success); | 428 bool success); |
429 void DidGetPersistentHostQuota(const std::string& host, | 429 void DidGetPersistentHostQuota(const std::string& host, |
430 const int64_t* quota, | 430 const int64_t* quota, |
431 bool success); | 431 bool success); |
432 void DidSetPersistentHostQuota(const std::string& host, | 432 void DidSetPersistentHostQuota(const std::string& host, |
(...skipping 15 matching lines...) Expand all Loading... |
448 void DeleteOnCorrectThread() const; | 448 void DeleteOnCorrectThread() const; |
449 | 449 |
450 void PostTaskAndReplyWithResultForDBThread( | 450 void PostTaskAndReplyWithResultForDBThread( |
451 const tracked_objects::Location& from_here, | 451 const tracked_objects::Location& from_here, |
452 const base::Callback<bool(QuotaDatabase*)>& task, | 452 const base::Callback<bool(QuotaDatabase*)>& task, |
453 const base::Callback<void(bool)>& reply); | 453 const base::Callback<void(bool)>& reply); |
454 | 454 |
455 static int64_t CallGetAmountOfFreeDiskSpace( | 455 static int64_t CallGetAmountOfFreeDiskSpace( |
456 GetVolumeInfoFn get_vol_info_fn, | 456 GetVolumeInfoFn get_vol_info_fn, |
457 const base::FilePath& profile_path); | 457 const base::FilePath& profile_path); |
458 static bool GetVolumeInfo(const base::FilePath& path, | |
459 uint64_t* available_space, | |
460 uint64_t* total_size); | |
461 | 458 |
462 const bool is_incognito_; | 459 const bool is_incognito_; |
463 const base::FilePath profile_path_; | 460 const base::FilePath profile_path_; |
464 | 461 |
465 scoped_refptr<QuotaManagerProxy> proxy_; | 462 scoped_refptr<QuotaManagerProxy> proxy_; |
466 bool db_disabled_; | 463 bool db_disabled_; |
467 bool eviction_disabled_; | 464 bool eviction_disabled_; |
468 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; | 465 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; |
469 scoped_refptr<base::SequencedTaskRunner> db_thread_; | 466 scoped_refptr<base::SequencedTaskRunner> db_thread_; |
470 mutable std::unique_ptr<QuotaDatabase> database_; | 467 mutable std::unique_ptr<QuotaDatabase> database_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
516 | 513 |
517 struct QuotaManagerDeleter { | 514 struct QuotaManagerDeleter { |
518 static void Destruct(const QuotaManager* manager) { | 515 static void Destruct(const QuotaManager* manager) { |
519 manager->DeleteOnCorrectThread(); | 516 manager->DeleteOnCorrectThread(); |
520 } | 517 } |
521 }; | 518 }; |
522 | 519 |
523 } // namespace storage | 520 } // namespace storage |
524 | 521 |
525 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 522 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
OLD | NEW |