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

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

Issue 1343273003: Integrate SiteEngagementEvictionPolicy with QuotaManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_eviction_policy
Patch Set: address comments Created 5 years, 2 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/client_usage_tracker.cc ('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 3e053887b1ff41fb41810af6b5bfa9f134f6aa3d..0e4884ba7e81e5359a33fb0e18b69f5604804d56 100644
--- a/storage/browser/quota/quota_manager.h
+++ b/storage/browser/quota/quota_manager.h
@@ -28,6 +28,8 @@
#include "storage/browser/quota/storage_observer.h"
#include "storage/browser/storage_browser_export.h"
+class SiteEngagementEvictionPolicyWithQuotaManagerTest;
+
namespace base {
class FilePath;
class SequencedTaskRunner;
@@ -70,10 +72,12 @@ struct STORAGE_EXPORT UsageAndQuota {
};
// 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.
+// An interface for deciding which origin's storage should be evicted when the
+// quota is exceeded.
class STORAGE_EXPORT QuotaEvictionPolicy {
public:
+ virtual ~QuotaEvictionPolicy() {}
+
// Returns the next origin to evict. It might return an empty GURL when there
// are no evictable origins.
virtual void GetEvictionOrigin(
@@ -94,6 +98,7 @@ class STORAGE_EXPORT QuotaEvictionHandler {
// Returns next origin to evict. It might return an empty GURL when there are
// no evictable origins.
virtual void GetEvictionOrigin(StorageType type,
+ int64 global_quota,
const GetOriginCallback& callback) = 0;
virtual void EvictOriginData(
@@ -194,6 +199,10 @@ class STORAGE_EXPORT QuotaManager
StorageType type,
bool enabled);
+ // Set the eviction policy to use when choosing an origin to evict.
+ void SetTemporaryStorageEvictionPolicy(
+ scoped_ptr<QuotaEvictionPolicy> policy);
+
// DeleteOriginData and DeleteHostData (surprisingly enough) delete data of a
// particular StorageType associated with either a specific origin or set of
// origins. Each method additionally requires a |quota_client_mask| which
@@ -286,6 +295,7 @@ class STORAGE_EXPORT QuotaManager
friend class QuotaManagerProxy;
friend class QuotaTemporaryStorageEvictor;
friend struct QuotaManagerDeleter;
+ friend class ::SiteEngagementEvictionPolicyWithQuotaManagerTest;
class GetUsageInfoTask;
@@ -373,8 +383,12 @@ class STORAGE_EXPORT QuotaManager
void DidGetPersistentGlobalUsageForHistogram(int64 usage,
int64 unlimited_usage);
+ void DidGetEvictionOrigin(const GetOriginCallback& callback,
+ const GURL& origin);
+
// QuotaEvictionHandler.
void GetEvictionOrigin(StorageType type,
+ int64 global_quota,
const GetOriginCallback& callback) override;
void EvictOriginData(const GURL& origin,
StorageType type,
@@ -435,6 +449,8 @@ class STORAGE_EXPORT QuotaManager
scoped_ptr<QuotaTemporaryStorageEvictor> temporary_storage_evictor_;
EvictionContext eviction_context_;
+ scoped_ptr<QuotaEvictionPolicy> temporary_storage_eviction_policy_;
+ bool is_getting_eviction_origin_;
ClosureQueue db_initialization_callbacks_;
AvailableSpaceCallbackQueue available_space_callbacks_;
« no previous file with comments | « storage/browser/quota/client_usage_tracker.cc ('k') | storage/browser/quota/quota_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698