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

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

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: Created 3 years, 9 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 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 "content/browser/service_worker/service_worker_storage.h" 5 #include "content/browser/service_worker/service_worker_storage.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after
1294 1294
1295 scoped_refptr<ServiceWorkerRegistration> 1295 scoped_refptr<ServiceWorkerRegistration>
1296 ServiceWorkerStorage::GetOrCreateRegistration( 1296 ServiceWorkerStorage::GetOrCreateRegistration(
1297 const ServiceWorkerDatabase::RegistrationData& data, 1297 const ServiceWorkerDatabase::RegistrationData& data,
1298 const ResourceList& resources) { 1298 const ResourceList& resources) {
1299 scoped_refptr<ServiceWorkerRegistration> registration = 1299 scoped_refptr<ServiceWorkerRegistration> registration =
1300 context_->GetLiveRegistration(data.registration_id); 1300 context_->GetLiveRegistration(data.registration_id);
1301 if (registration) 1301 if (registration)
1302 return registration; 1302 return registration;
1303 1303
1304 registration = new ServiceWorkerRegistration( 1304 registration = new ServiceWorkerRegistration(data.scope, data.use_cache,
1305 data.scope, data.registration_id, context_); 1305 data.registration_id, context_);
1306 registration->set_resources_total_size_bytes(data.resources_total_size_bytes); 1306 registration->set_resources_total_size_bytes(data.resources_total_size_bytes);
1307 registration->set_last_update_check(data.last_update_check); 1307 registration->set_last_update_check(data.last_update_check);
1308 if (pending_deletions_.find(data.registration_id) != 1308 if (pending_deletions_.find(data.registration_id) !=
1309 pending_deletions_.end()) { 1309 pending_deletions_.end()) {
1310 registration->set_is_deleted(true); 1310 registration->set_is_deleted(true);
1311 } 1311 }
1312 scoped_refptr<ServiceWorkerVersion> version = 1312 scoped_refptr<ServiceWorkerVersion> version =
1313 context_->GetLiveVersion(data.version_id); 1313 context_->GetLiveVersion(data.version_id);
1314 if (!version) { 1314 if (!version) {
1315 version = new ServiceWorkerVersion( 1315 version = new ServiceWorkerVersion(
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 callback.Run(SERVICE_WORKER_ERROR_FAILED); 1850 callback.Run(SERVICE_WORKER_ERROR_FAILED);
1851 return; 1851 return;
1852 } 1852 }
1853 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; 1853 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully.";
1854 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( 1854 ServiceWorkerMetrics::RecordDeleteAndStartOverResult(
1855 ServiceWorkerMetrics::DELETE_OK); 1855 ServiceWorkerMetrics::DELETE_OK);
1856 callback.Run(SERVICE_WORKER_OK); 1856 callback.Run(SERVICE_WORKER_OK);
1857 } 1857 }
1858 1858
1859 } // namespace content 1859 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698