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

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

Issue 2592793002: Revert of Change how the quota system computes the total poolsize for temporary storage (Closed)
Patch Set: Created 3 years, 12 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') | tools/metrics/histograms/histograms.xml » ('j') | 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 <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 129 }
130 130
131 void UsageTracker::UpdateUsageCache(QuotaClient::ID client_id, 131 void UsageTracker::UpdateUsageCache(QuotaClient::ID client_id,
132 const GURL& origin, 132 const GURL& origin,
133 int64_t delta) { 133 int64_t delta) {
134 ClientUsageTracker* client_tracker = GetClientTracker(client_id); 134 ClientUsageTracker* client_tracker = GetClientTracker(client_id);
135 DCHECK(client_tracker); 135 DCHECK(client_tracker);
136 client_tracker->UpdateUsageCache(origin, delta); 136 client_tracker->UpdateUsageCache(origin, delta);
137 } 137 }
138 138
139 int64_t UsageTracker::GetCachedUsage() const {
140 int64_t usage = 0;
141 for (const auto& client_id_and_tracker : client_tracker_map_)
142 usage += client_id_and_tracker.second->GetCachedUsage();
143 return usage;
144 }
145
146 void UsageTracker::GetCachedHostsUsage( 139 void UsageTracker::GetCachedHostsUsage(
147 std::map<std::string, int64_t>* host_usage) const { 140 std::map<std::string, int64_t>* host_usage) const {
148 DCHECK(host_usage); 141 DCHECK(host_usage);
149 host_usage->clear(); 142 host_usage->clear();
150 for (const auto& client_id_and_tracker : client_tracker_map_) 143 for (const auto& client_id_and_tracker : client_tracker_map_)
151 client_id_and_tracker.second->GetCachedHostsUsage(host_usage); 144 client_id_and_tracker.second->GetCachedHostsUsage(host_usage);
152 } 145 }
153 146
154 void UsageTracker::GetCachedOriginsUsage( 147 void UsageTracker::GetCachedOriginsUsage(
155 std::map<GURL, int64_t>* origin_usage) const { 148 std::map<GURL, int64_t>* origin_usage) const {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 // Defend against confusing inputs from clients. 213 // Defend against confusing inputs from clients.
221 if (info->usage < 0) 214 if (info->usage < 0)
222 info->usage = 0; 215 info->usage = 0;
223 216
224 // All the clients have returned their usage data. Dispatch the 217 // All the clients have returned their usage data. Dispatch the
225 // pending callbacks. 218 // pending callbacks.
226 host_usage_callbacks_.Run(host, info->usage); 219 host_usage_callbacks_.Run(host, info->usage);
227 } 220 }
228 221
229 } // namespace storage 222 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/quota/usage_tracker.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698