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

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: Extract SiteEngagementScoreProvider interface Created 5 years, 5 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
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..994d9616640f2350a354cf8a41e2c35ac53c464f 100644
--- a/storage/browser/quota/quota_manager.h
+++ b/storage/browser/quota/quota_manager.h
@@ -69,20 +69,33 @@ 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 TemporaryStorageEvictionPolicy {
michaeln 2015/07/23 02:26:18 I'd vote for a simpler name, QuotaEvictionPolicy.
calamity 2015/07/28 01:07:59 Done.
+ public:
+ // Returns the next origin to evict. It might return an empty GURL when there
+ // are no evictable origins.
+ virtual void GetEvictionOrigin(const std::map<GURL, int64>& usage_map,
michaeln 2015/07/23 02:22:32 I think we need to add SpecialStoragePolicy* to th
calamity 2015/07/28 01:07:59 I think the last access time is an improvement to
+ int64 global_quota,
+ const GetEvictionOriginCallback& callback) = 0;
+
+ protected:
+ ~TemporaryStorageEvictionPolicy() {}
+};
+
// 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 GetEvictionOriginCallback& callback) = 0;
virtual void EvictOriginData(
const GURL& origin,
@@ -362,14 +375,17 @@ class STORAGE_EXPORT QuotaManager
int64 unlimited_usage);
// QuotaEvictionHandler.
- void GetLRUOrigin(StorageType type,
- const GetLRUOriginCallback& callback) override;
+ void GetEvictionOrigin(StorageType type,
+ const GetEvictionOriginCallback& callback) override;
void EvictOriginData(const GURL& origin,
StorageType type,
const EvictOriginDataCallback& callback) override;
void GetUsageAndQuotaForEviction(
const UsageAndQuotaCallback& callback) override;
+ void GetLRUOrigin(StorageType type,
+ const GetEvictionOriginCallback& callback);
+
void DidSetTemporaryGlobalOverrideQuota(const QuotaCallback& callback,
const int64* new_quota,
bool success);
@@ -408,7 +424,7 @@ class STORAGE_EXPORT QuotaManager
scoped_refptr<base::SequencedTaskRunner> db_thread_;
mutable scoped_ptr<QuotaDatabase> database_;
- GetLRUOriginCallback lru_origin_callback_;
+ GetEvictionOriginCallback lru_origin_callback_;
std::set<GURL> access_notified_origins_;
QuotaClientList clients_;

Powered by Google App Engine
This is Rietveld 408576698