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

Side by Side Diff: chrome/browser/engagement/site_engagement_eviction_policy.h

Issue 1354543002: Exclude in-use origins from storage evictions for all QuotaEvictionPolicies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hook_it_up_gooood
Patch Set: rebase 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ 5 #ifndef CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_
6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ 6 #define CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 12 matching lines...) Expand all
23 class SiteEngagementEvictionPolicy : public storage::QuotaEvictionPolicy { 23 class SiteEngagementEvictionPolicy : public storage::QuotaEvictionPolicy {
24 public: 24 public:
25 SiteEngagementEvictionPolicy(storage::StorageType type, 25 SiteEngagementEvictionPolicy(storage::StorageType type,
26 storage::QuotaManager* manager, 26 storage::QuotaManager* manager,
27 content::BrowserContext* browser_context); 27 content::BrowserContext* browser_context);
28 ~SiteEngagementEvictionPolicy() override; 28 ~SiteEngagementEvictionPolicy() override;
29 29
30 // Overridden from storage::QuotaEvictionPolicy: 30 // Overridden from storage::QuotaEvictionPolicy:
31 void GetEvictionOrigin(const scoped_refptr<storage::SpecialStoragePolicy>& 31 void GetEvictionOrigin(const scoped_refptr<storage::SpecialStoragePolicy>&
32 special_storage_policy, 32 special_storage_policy,
33 const std::set<GURL>& exceptions,
33 const storage::GetOriginCallback& callback) override; 34 const storage::GetOriginCallback& callback) override;
34 35
35 private: 36 private:
36 friend class SiteEngagementEvictionPolicyTest; 37 friend class SiteEngagementEvictionPolicyTest;
37 friend class SiteEngagementEvictionPolicyWithQuotaManagerTest; 38 friend class SiteEngagementEvictionPolicyWithQuotaManagerTest;
38 39
39 static void SetSiteEngagementScoreProviderCallbackForTests( 40 static void SetSiteEngagementScoreProviderCallbackForTests(
40 base::Callback<SiteEngagementScoreProvider*(content::BrowserContext*)>* 41 base::Callback<SiteEngagementScoreProvider*(content::BrowserContext*)>*
41 callback); 42 callback);
42 43
43 static GURL CalculateEvictionOriginForTests( 44 static GURL CalculateEvictionOriginForTests(
44 const scoped_refptr<storage::SpecialStoragePolicy>& 45 const scoped_refptr<storage::SpecialStoragePolicy>&
45 special_storage_policy, 46 special_storage_policy,
46 SiteEngagementScoreProvider* score_provider, 47 SiteEngagementScoreProvider* score_provider,
48 const std::set<GURL>& exceptions,
47 const std::map<GURL, int64>& usage_map, 49 const std::map<GURL, int64>& usage_map,
48 int64 global_quota); 50 int64 global_quota);
49 51
50 void DidGetGlobalUsage(storage::StorageType type, int64, int64); 52 void DidGetGlobalUsage(storage::StorageType type, int64, int64);
51 void DidGetGlobalQuota(storage::QuotaStatusCode status, int64 quota); 53 void DidGetGlobalQuota(storage::QuotaStatusCode status, int64 quota);
52 void OnQuotaTasksCompleted(); 54 void OnQuotaTasksCompleted();
53 55
54 const storage::StorageType type_; 56 const storage::StorageType type_;
55 storage::QuotaManager* const manager_; 57 storage::QuotaManager* const manager_;
56 content::BrowserContext* const browser_context_; 58 content::BrowserContext* const browser_context_;
57 59
58 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_; 60 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy_;
61 std::set<GURL> exceptions_;
59 std::map<GURL, int64> usage_map_; 62 std::map<GURL, int64> usage_map_;
60 int64 global_quota_; 63 int64 global_quota_;
61 64
62 int remaining_tasks_; 65 int remaining_tasks_;
63 66
64 storage::GetOriginCallback eviction_origin_callback_; 67 storage::GetOriginCallback eviction_origin_callback_;
65 68
66 base::WeakPtrFactory<SiteEngagementEvictionPolicy> weak_factory_; 69 base::WeakPtrFactory<SiteEngagementEvictionPolicy> weak_factory_;
67 70
68 DISALLOW_COPY_AND_ASSIGN(SiteEngagementEvictionPolicy); 71 DISALLOW_COPY_AND_ASSIGN(SiteEngagementEvictionPolicy);
69 }; 72 };
70 73
71 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_ 74 #endif // CHROME_BROWSER_ENGAGEMENT_SITE_ENGAGEMENT_EVICTION_POLICY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698