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

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

Issue 1343273003: Integrate SiteEngagementEvictionPolicy with QuotaManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@add_eviction_policy
Patch Set: address comments Created 5 years, 2 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
« no previous file with comments | « storage/browser/quota/usage_tracker.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/usage_tracker.h" 5 #include "storage/browser/quota/usage_tracker.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 } 137 }
138 138
139 void UsageTracker::GetCachedHostsUsage( 139 void UsageTracker::GetCachedHostsUsage(
140 std::map<std::string, int64>* host_usage) const { 140 std::map<std::string, int64>* host_usage) const {
141 DCHECK(host_usage); 141 DCHECK(host_usage);
142 host_usage->clear(); 142 host_usage->clear();
143 for (const auto& client_id_and_tracker : client_tracker_map_) 143 for (const auto& client_id_and_tracker : client_tracker_map_)
144 client_id_and_tracker.second->GetCachedHostsUsage(host_usage); 144 client_id_and_tracker.second->GetCachedHostsUsage(host_usage);
145 } 145 }
146 146
147 void UsageTracker::GetCachedOriginsUsage(
148 std::map<GURL, int64>* origin_usage) const {
149 DCHECK(origin_usage);
150 origin_usage->clear();
151 for (const auto& client_id_and_tracker : client_tracker_map_)
152 client_id_and_tracker.second->GetCachedOriginsUsage(origin_usage);
153 }
154
147 void UsageTracker::GetCachedOrigins(std::set<GURL>* origins) const { 155 void UsageTracker::GetCachedOrigins(std::set<GURL>* origins) const {
148 DCHECK(origins); 156 DCHECK(origins);
149 origins->clear(); 157 origins->clear();
150 for (const auto& client_id_and_tracker : client_tracker_map_) 158 for (const auto& client_id_and_tracker : client_tracker_map_)
151 client_id_and_tracker.second->GetCachedOrigins(origins); 159 client_id_and_tracker.second->GetCachedOrigins(origins);
152 } 160 }
153 161
154 void UsageTracker::SetUsageCacheEnabled(QuotaClient::ID client_id, 162 void UsageTracker::SetUsageCacheEnabled(QuotaClient::ID client_id,
155 const GURL& origin, 163 const GURL& origin,
156 bool enabled) { 164 bool enabled) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // Defend against confusing inputs from clients. 213 // Defend against confusing inputs from clients.
206 if (info->usage < 0) 214 if (info->usage < 0)
207 info->usage = 0; 215 info->usage = 0;
208 216
209 // All the clients have returned their usage data. Dispatch the 217 // All the clients have returned their usage data. Dispatch the
210 // pending callbacks. 218 // pending callbacks.
211 host_usage_callbacks_.Run(host, info->usage); 219 host_usage_callbacks_.Run(host, info->usage);
212 } 220 }
213 221
214 } // namespace storage 222 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/quota/usage_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698