Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ | |
| 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ | |
| 7 | |
| 8 #include "storage/browser/quota/quota_manager.h" | |
| 9 | |
| 10 class SiteEngagementService; | |
| 11 | |
| 12 class SiteEngagementEvictionPolicy | |
| 13 : public storage::TemporaryStorageEvictionPolicy { | |
| 14 public: | |
| 15 explicit SiteEngagementEvictionPolicy(SiteEngagementService* service); | |
| 16 virtual ~SiteEngagementEvictionPolicy(); | |
| 17 | |
| 18 // Returns the origin from |usage_map| to evict based on usage and site | |
|
raymes
2015/07/08 04:43:29
nit: Returns the next origin from |usage_map| to e
calamity
2015/07/10 05:05:05
Done.
| |
| 19 // engagement. | |
| 20 GURL GetEvictionOriginOnUIThread(const std::map<GURL, int64>& usage_map, | |
| 21 int64 global_quota); | |
|
raymes
2015/07/08 04:43:29
nit: include gurl.h and <map>
calamity
2015/07/10 05:05:05
Done.
| |
| 22 | |
| 23 // Overridden from storage::TemporaryStorageEvictionPolicy: | |
| 24 void GetEvictionOrigin( | |
| 25 const std::map<GURL, int64>& usage_map, | |
| 26 int64 global_quota, | |
| 27 const storage::GetEvictionOriginCallback& callback) override; | |
| 28 | |
| 29 protected: | |
| 30 // Overridden in tests. | |
| 31 virtual int GetScore(const GURL& origin); | |
| 32 virtual int GetTotalEngagementPoints(); | |
| 33 | |
| 34 private: | |
| 35 // Gets the quota that an origin deserves based on its site engagement. | |
| 36 int64 GetSoftQuotaForOrigin(const GURL& origin, | |
| 37 int64 global_quota, | |
| 38 int total_engagement_points); | |
| 39 | |
| 40 void ReplyWithEvictionOrigin( | |
| 41 const storage::GetEvictionOriginCallback& callback, | |
| 42 const GURL& origin_to_evict); | |
| 43 | |
| 44 SiteEngagementService* engagement_service_; | |
| 45 | |
| 46 DISALLOW_COPY_AND_ASSIGN(SiteEngagementEvictionPolicy); | |
|
raymes
2015/07/08 04:43:29
base/macros.h
calamity
2015/07/10 05:05:05
Done.
| |
| 47 }; | |
| 48 | |
| 49 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ | |
| OLD | NEW |