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

Unified Diff: content/browser/service_worker/service_worker_context_wrapper.cc

Issue 672813002: [ServiceWorker] Added size deltas and total size computation for QuotaM. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Switching size storage to the registration info, not the version. Updated tests Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_context_wrapper.cc
diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
index b135a85056b3bed00f969ae7059a047f2803fc7a..cc6f547fe30d1de42ffba512572e51518a30e1a0 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -184,26 +184,20 @@ void ServiceWorkerContextWrapper::DidGetAllRegistrationsForGetAllOrigins(
std::vector<ServiceWorkerUsageInfo> usage_infos;
std::map<GURL, ServiceWorkerUsageInfo> origins;
- for (std::vector<ServiceWorkerRegistrationInfo>::const_iterator it =
- registrations.begin();
- it != registrations.end();
- ++it) {
- const ServiceWorkerRegistrationInfo& registration_info = *it;
+ for (const auto& registration_info : registrations) {
GURL origin = registration_info.pattern.GetOrigin();
ServiceWorkerUsageInfo& usage_info = origins[origin];
if (usage_info.origin.is_empty())
usage_info.origin = origin;
usage_info.scopes.push_back(registration_info.pattern);
+ usage_info.total_size_bytes +=
+ registration_info.active_version_total_size_bytes;
}
- for (std::map<GURL, ServiceWorkerUsageInfo>::const_iterator it =
- origins.begin();
- it != origins.end();
- ++it) {
- usage_infos.push_back(it->second);
+ for (const auto& origin_info_pair : origins) {
+ usage_infos.push_back(origin_info_pair.second);
}
-
callback.Run(usage_infos);
}

Powered by Google App Engine
This is Rietveld 408576698