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

Side by Side Diff: storage/browser/quota/client_usage_tracker.cc

Issue 1343273003: Integrate SiteEngagementEvictionPolicy with QuotaManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_eviction_policy
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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "storage/browser/quota/client_usage_tracker.h" 5 #include "storage/browser/quota/client_usage_tracker.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "net/base/net_util.h" 9 #include "net/base/net_util.h"
10 #include "storage/browser/quota/storage_monitor.h" 10 #include "storage/browser/quota/storage_monitor.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 void ClientUsageTracker::GetCachedHostsUsage( 167 void ClientUsageTracker::GetCachedHostsUsage(
168 std::map<std::string, int64>* host_usage) const { 168 std::map<std::string, int64>* host_usage) const {
169 DCHECK(host_usage); 169 DCHECK(host_usage);
170 for (const auto& host_and_usage_map : cached_usage_by_host_) { 170 for (const auto& host_and_usage_map : cached_usage_by_host_) {
171 const std::string& host = host_and_usage_map.first; 171 const std::string& host = host_and_usage_map.first;
172 (*host_usage)[host] += GetCachedHostUsage(host); 172 (*host_usage)[host] += GetCachedHostUsage(host);
173 } 173 }
174 } 174 }
175 175
176 void ClientUsageTracker::GetUsageForCachedOrigins(
raymes 2015/09/22 06:08:49 What's the difference between this and the above f
calamity 2015/09/23 01:46:24 This one considers ports and scheme etc. The one a
raymes 2015/09/23 01:56:14 Should we use the same naming convention? GetCache
calamity 2015/09/23 02:15:56 There was a method that was already named that in
177 std::map<GURL, int64>* origin_usage) const {
178 DCHECK(origin_usage);
179 for (const auto& host_and_usage_map : cached_usage_by_host_) {
180 for (const auto& origin_and_usage : host_and_usage_map.second)
181 (*origin_usage)[origin_and_usage.first] += origin_and_usage.second;
182 }
183 }
184
176 void ClientUsageTracker::GetCachedOrigins(std::set<GURL>* origins) const { 185 void ClientUsageTracker::GetCachedOrigins(std::set<GURL>* origins) const {
177 DCHECK(origins); 186 DCHECK(origins);
178 for (const auto& host_and_usage_map : cached_usage_by_host_) { 187 for (const auto& host_and_usage_map : cached_usage_by_host_) {
179 for (const auto& origin_and_usage : host_and_usage_map.second) 188 for (const auto& origin_and_usage : host_and_usage_map.second)
180 origins->insert(origin_and_usage.first); 189 origins->insert(origin_and_usage.first);
181 } 190 }
182 } 191 }
183 192
184 void ClientUsageTracker::SetUsageCacheEnabled(const GURL& origin, 193 void ClientUsageTracker::SetUsageCacheEnabled(const GURL& origin,
185 bool enabled) { 194 bool enabled) {
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 } 460 }
452 461
453 bool ClientUsageTracker::IsStorageUnlimited(const GURL& origin) const { 462 bool ClientUsageTracker::IsStorageUnlimited(const GURL& origin) const {
454 if (type_ == kStorageTypeSyncable) 463 if (type_ == kStorageTypeSyncable)
455 return false; 464 return false;
456 return special_storage_policy_.get() && 465 return special_storage_policy_.get() &&
457 special_storage_policy_->IsStorageUnlimited(origin); 466 special_storage_policy_->IsStorageUnlimited(origin);
458 } 467 }
459 468
460 } // namespace storage 469 } // namespace storage
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698