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

Side by Side Diff: content/browser/service_worker/service_worker_database.cc

Issue 633273002: Added quota client for serviceworker. Enables 'clear past <time> data'. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase 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 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 "content/browser/service_worker/service_worker_database.h" 5 #include "content/browser/service_worker/service_worker_database.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 DCHECK(out); 208 DCHECK(out);
209 ServiceWorkerRegistrationData data; 209 ServiceWorkerRegistrationData data;
210 if (!data.ParseFromString(serialized)) 210 if (!data.ParseFromString(serialized))
211 return ServiceWorkerDatabase::STATUS_ERROR_CORRUPTED; 211 return ServiceWorkerDatabase::STATUS_ERROR_CORRUPTED;
212 212
213 GURL scope_url(data.scope_url()); 213 GURL scope_url(data.scope_url());
214 GURL script_url(data.script_url()); 214 GURL script_url(data.script_url());
215 if (!scope_url.is_valid() || 215 if (!scope_url.is_valid() ||
216 !script_url.is_valid() || 216 !script_url.is_valid() ||
217 scope_url.GetOrigin() != script_url.GetOrigin()) { 217 scope_url.GetOrigin() != script_url.GetOrigin()) {
218 DLOG(ERROR) << "Scope URL '" << data.scope_url() << "' and/or script url '"
219 << data.script_url()
220 << "' are invalid or have mismatching origins.";
218 return ServiceWorkerDatabase::STATUS_ERROR_CORRUPTED; 221 return ServiceWorkerDatabase::STATUS_ERROR_CORRUPTED;
219 } 222 }
220 223
221 // Convert ServiceWorkerRegistrationData to RegistrationData. 224 // Convert ServiceWorkerRegistrationData to RegistrationData.
222 out->registration_id = data.registration_id(); 225 out->registration_id = data.registration_id();
223 out->scope = scope_url; 226 out->scope = scope_url;
224 out->script = script_url; 227 out->script = script_url;
225 out->version_id = data.version_id(); 228 out->version_id = data.version_id();
226 out->is_active = data.is_active(); 229 out->is_active = data.is_active();
227 out->has_fetch_handler = data.has_fetch_handler(); 230 out->has_fetch_handler = data.has_fetch_handler();
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 1129
1127 void ServiceWorkerDatabase::HandleWriteResult( 1130 void ServiceWorkerDatabase::HandleWriteResult(
1128 const tracked_objects::Location& from_here, 1131 const tracked_objects::Location& from_here,
1129 Status status) { 1132 Status status) {
1130 if (status != STATUS_OK) 1133 if (status != STATUS_OK)
1131 Disable(from_here, status); 1134 Disable(from_here, status);
1132 ServiceWorkerMetrics::CountWriteDatabaseResult(status); 1135 ServiceWorkerMetrics::CountWriteDatabaseResult(status);
1133 } 1136 }
1134 1137
1135 } // namespace content 1138 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698