Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Unified Diff: storage/browser/quota/quota_manager.h

Issue 1221523003: Add a SiteEngagementEvictionPolicy. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get_total_engagement_points
Patch Set: remove unnecessary destructor Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « storage/browser/quota/quota_callbacks.h ('k') | storage/browser/quota/quota_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..506aa0ad05f806d9bd3ec58f1734ca2829a97229 100644
--- a/storage/browser/quota/quota_manager.h
+++ b/storage/browser/quota/quota_manager.h
@@ -69,20 +69,32 @@ 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;
+};
+
// 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 +374,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 +422,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_;
« no previous file with comments | « storage/browser/quota/quota_callbacks.h ('k') | storage/browser/quota/quota_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698