Index: chrome/browser/engagement/site_engagement_eviction_policy.cc |
diff --git a/chrome/browser/engagement/site_engagement_eviction_policy.cc b/chrome/browser/engagement/site_engagement_eviction_policy.cc |
index ea99604ed279e6dd660bfa7289b2a320577d6793..02b2152ef054d0dbd11310b51f8c53d63038c163 100644 |
--- a/chrome/browser/engagement/site_engagement_eviction_policy.cc |
+++ b/chrome/browser/engagement/site_engagement_eviction_policy.cc |
@@ -34,6 +34,7 @@ int64 GetSoftQuotaForOrigin(const GURL& origin, |
GURL DoCalculateEvictionOrigin( |
const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy, |
SiteEngagementScoreProvider* score_provider, |
+ const std::set<GURL>& exceptions, |
const std::map<GURL, int64>& usage_map, |
int64 global_quota) { |
// TODO(calamity): Integrate storage access frequency as an input to this |
@@ -63,7 +64,7 @@ GURL DoCalculateEvictionOrigin( |
int64 overuse = usage.second - GetSoftQuotaForOrigin( |
origin, score_provider->GetScore(origin), |
total_engagement_points, global_quota); |
- if (overuse > max_overuse) { |
+ if (overuse > max_overuse && exceptions.count(origin) == 0) { |
max_overuse = overuse; |
origin_to_evict = origin; |
} |
@@ -82,6 +83,7 @@ SiteEngagementScoreProvider* GetSiteEngagementService( |
GURL GetSiteEngagementEvictionOriginOnUIThread( |
const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy, |
content::BrowserContext* browser_context, |
+ const std::set<GURL>& exceptions, |
const std::map<GURL, int64>& usage_map, |
int64 global_quota) { |
DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
@@ -95,7 +97,7 @@ GURL GetSiteEngagementEvictionOriginOnUIThread( |
return GURL(); |
return DoCalculateEvictionOrigin(special_storage_policy, score_provider, |
- usage_map, global_quota); |
+ exceptions, usage_map, global_quota); |
} |
} // namespace |
@@ -115,6 +117,7 @@ SiteEngagementEvictionPolicy::~SiteEngagementEvictionPolicy() {} |
void SiteEngagementEvictionPolicy::GetEvictionOrigin( |
const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy, |
+ const std::set<GURL>& exceptions, |
const storage::GetOriginCallback& callback) { |
DCHECK_CURRENTLY_ON(content::BrowserThread::IO); |
DCHECK_EQ(0, remaining_tasks_); |
@@ -160,8 +163,8 @@ void SiteEngagementEvictionPolicy::OnQuotaTasksCompleted() { |
content::BrowserThread::PostTaskAndReplyWithResult( |
content::BrowserThread::UI, FROM_HERE, |
base::Bind(&GetSiteEngagementEvictionOriginOnUIThread, |
- special_storage_policy_, browser_context_, usage_map_, |
- global_quota_), |
+ special_storage_policy_, browser_context_, exceptions_, |
+ usage_map_, global_quota_), |
eviction_origin_callback_); |
} |
@@ -177,8 +180,9 @@ void SiteEngagementEvictionPolicy:: |
GURL SiteEngagementEvictionPolicy::CalculateEvictionOriginForTests( |
const scoped_refptr<storage::SpecialStoragePolicy>& special_storage_policy, |
SiteEngagementScoreProvider* score_provider, |
+ const std::set<GURL>& exceptions, |
const std::map<GURL, int64>& usage_map, |
int64 global_quota) { |
return DoCalculateEvictionOrigin(special_storage_policy, score_provider, |
- usage_map, global_quota); |
+ exceptions, usage_map, global_quota); |
} |