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

Unified Diff: chrome/browser/engagement/site_engagement_eviction_policy.h

Issue 1343273003: Integrate SiteEngagementEvictionPolicy with QuotaManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_eviction_policy
Patch Set: Created 5 years, 3 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: chrome/browser/engagement/site_engagement_eviction_policy.h
diff --git a/chrome/browser/engagement/site_engagement_eviction_policy.h b/chrome/browser/engagement/site_engagement_eviction_policy.h
index 470b0ec33d2e617ca8527dedc75540081b74f7e0..0c2f49772447c15f5bd08960b233026e421c04f0 100644
--- a/chrome/browser/engagement/site_engagement_eviction_policy.h
+++ b/chrome/browser/engagement/site_engagement_eviction_policy.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
+#include "base/memory/weak_ptr.h"
#include "storage/browser/quota/quota_manager.h"
#include "url/gurl.h"
@@ -21,19 +22,23 @@ class SiteEngagementScoreProvider;
class SiteEngagementEvictionPolicy : public storage::QuotaEvictionPolicy {
public:
- explicit SiteEngagementEvictionPolicy(
- content::BrowserContext* browser_context);
- virtual ~SiteEngagementEvictionPolicy();
+ SiteEngagementEvictionPolicy(storage::StorageType type,
+ storage::QuotaManager* manager,
+ content::BrowserContext* browser_context);
+ ~SiteEngagementEvictionPolicy() override;
// Overridden from storage::QuotaEvictionPolicy:
void GetEvictionOrigin(const scoped_refptr<storage::SpecialStoragePolicy>&
special_storage_policy,
- const std::map<GURL, int64>& usage_map,
- int64 global_quota,
const storage::GetOriginCallback& callback) override;
private:
friend class SiteEngagementEvictionPolicyTest;
+ friend class SiteEngagementEvictionPolicyWithQuotaManagerTest;
+
+ static void SetSiteEngagementScoreProviderCallback(
+ base::Callback<SiteEngagementScoreProvider*(content::BrowserContext*)>
+ callback);
static GURL CalculateEvictionOrigin(
const scoped_refptr<storage::SpecialStoragePolicy>&
@@ -42,7 +47,23 @@ class SiteEngagementEvictionPolicy : public storage::QuotaEvictionPolicy {
const std::map<GURL, int64>& usage_map,
int64 global_quota);
- content::BrowserContext* browser_context_;
+ void DidGetGlobalUsage(storage::StorageType type, int64, int64);
+ void DidGetGlobalQuota(storage::QuotaStatusCode status, int64 quota);
+ void OnQuotaTasksCompleted();
+
+ const storage::StorageType type_;
+ storage::QuotaManager* const manager_;
+ content::BrowserContext* const browser_context_;
+
+ scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
+ std::map<GURL, int64> usage_map_;
+ int64 global_quota_;
+
+ int remaining_tasks_;
+
+ storage::GetOriginCallback eviction_origin_callback_;
+
+ base::WeakPtrFactory<SiteEngagementEvictionPolicy> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(SiteEngagementEvictionPolicy);
};

Powered by Google App Engine
This is Rietveld 408576698