Chromium Code Reviews| Index: storage/browser/quota/quota_manager.h |
| diff --git a/storage/browser/quota/quota_manager.h b/storage/browser/quota/quota_manager.h |
| index 07106dfe5fb86d299a4c84473182a0490f536f31..1987d6d456205d06d97d3c6a98547c35a250c327 100644 |
| --- a/storage/browser/quota/quota_manager.h |
| +++ b/storage/browser/quota/quota_manager.h |
| @@ -69,20 +69,35 @@ struct STORAGE_EXPORT UsageAndQuota { |
| int64 available_disk_space); |
| }; |
| +// TODO(calamity): Use this in the temporary storage eviction path. |
| +// An interface for deciding which origin's temporary storage should be evicted |
| +// when the quota is exceeded. |
| +class STORAGE_EXPORT QuotaEvictionPolicy { |
| + public: |
| + // Returns the next origin to evict. It might return an empty GURL when there |
| + // are no evictable origins. |
| + virtual void GetEvictionOrigin( |
| + const scoped_refptr<SpecialStoragePolicy>& special_storage_policy, |
| + const std::map<GURL, int64>& usage_map, |
| + int64 global_quota, |
| + const GetOriginCallback& callback) = 0; |
| + |
| + protected: |
| + ~QuotaEvictionPolicy() {} |
|
michaeln
2015/08/26 23:32:37
Should this dtor be virtual and/or public?
What's
calamity
2015/08/27 05:05:01
Oops. Yes, this destructor doesn't need to be defi
|
| +}; |
| + |
| // An interface called by QuotaTemporaryStorageEvictor. |
| class STORAGE_EXPORT QuotaEvictionHandler { |
| public: |
| - typedef base::Callback<void(const GURL&)> GetLRUOriginCallback; |
| typedef StatusCallback EvictOriginDataCallback; |
| typedef base::Callback<void(QuotaStatusCode status, |
| const UsageAndQuota& usage_and_quota)> |
| UsageAndQuotaCallback; |
| - // Returns the least recently used origin. It might return empty |
| - // GURL when there are no evictable origins. |
| - virtual void GetLRUOrigin( |
| - StorageType type, |
| - const GetLRUOriginCallback& callback) = 0; |
| + // Returns next origin to evict. It might return an empty GURL when there are |
| + // no evictable origins. |
| + virtual void GetEvictionOrigin(StorageType type, |
| + const GetOriginCallback& callback) = 0; |
| virtual void EvictOriginData( |
| const GURL& origin, |
| @@ -362,14 +377,16 @@ class STORAGE_EXPORT QuotaManager |
| int64 unlimited_usage); |
| // QuotaEvictionHandler. |
| - void GetLRUOrigin(StorageType type, |
| - const GetLRUOriginCallback& callback) override; |
| + void GetEvictionOrigin(StorageType type, |
| + const GetOriginCallback& callback) override; |
| void EvictOriginData(const GURL& origin, |
| StorageType type, |
| const EvictOriginDataCallback& callback) override; |
| void GetUsageAndQuotaForEviction( |
| const UsageAndQuotaCallback& callback) override; |
| + void GetLRUOrigin(StorageType type, const GetOriginCallback& callback); |
| + |
| void DidSetTemporaryGlobalOverrideQuota(const QuotaCallback& callback, |
| const int64* new_quota, |
| bool success); |
| @@ -408,7 +425,7 @@ class STORAGE_EXPORT QuotaManager |
| scoped_refptr<base::SequencedTaskRunner> db_thread_; |
| mutable scoped_ptr<QuotaDatabase> database_; |
| - GetLRUOriginCallback lru_origin_callback_; |
| + GetOriginCallback lru_origin_callback_; |
| std::set<GURL> access_notified_origins_; |
| QuotaClientList clients_; |