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

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

Issue 1656933003: Add origins argument to registerForeignFetchScopes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add url::Origin::operator== to make tests simpler Created 4 years, 10 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 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 396
397 ServiceWorkerDatabase::RegistrationData data; 397 ServiceWorkerDatabase::RegistrationData data;
398 data.registration_id = registration->id(); 398 data.registration_id = registration->id();
399 data.scope = registration->pattern(); 399 data.scope = registration->pattern();
400 data.script = version->script_url(); 400 data.script = version->script_url();
401 data.has_fetch_handler = true; 401 data.has_fetch_handler = true;
402 data.version_id = version->version_id(); 402 data.version_id = version->version_id();
403 data.last_update_check = registration->last_update_check(); 403 data.last_update_check = registration->last_update_check();
404 data.is_active = (version == registration->active_version()); 404 data.is_active = (version == registration->active_version());
405 data.foreign_fetch_scopes = version->foreign_fetch_scopes(); 405 data.foreign_fetch_scopes = version->foreign_fetch_scopes();
406 data.foreign_fetch_origins = version->foreign_fetch_origins();
406 407
407 ResourceList resources; 408 ResourceList resources;
408 version->script_cache_map()->GetResources(&resources); 409 version->script_cache_map()->GetResources(&resources);
409 410
410 if (resources.empty()) { 411 if (resources.empty()) {
411 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED)); 412 RunSoon(FROM_HERE, base::Bind(callback, SERVICE_WORKER_ERROR_FAILED));
412 return; 413 return;
413 } 414 }
414 415
415 uint64_t resources_total_size_bytes = 0; 416 uint64_t resources_total_size_bytes = 0;
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after
1221 } 1222 }
1222 scoped_refptr<ServiceWorkerVersion> version = 1223 scoped_refptr<ServiceWorkerVersion> version =
1223 context_->GetLiveVersion(data.version_id); 1224 context_->GetLiveVersion(data.version_id);
1224 if (!version) { 1225 if (!version) {
1225 version = new ServiceWorkerVersion( 1226 version = new ServiceWorkerVersion(
1226 registration.get(), data.script, data.version_id, context_); 1227 registration.get(), data.script, data.version_id, context_);
1227 version->SetStatus(data.is_active ? 1228 version->SetStatus(data.is_active ?
1228 ServiceWorkerVersion::ACTIVATED : ServiceWorkerVersion::INSTALLED); 1229 ServiceWorkerVersion::ACTIVATED : ServiceWorkerVersion::INSTALLED);
1229 version->script_cache_map()->SetResources(resources); 1230 version->script_cache_map()->SetResources(resources);
1230 version->set_foreign_fetch_scopes(data.foreign_fetch_scopes); 1231 version->set_foreign_fetch_scopes(data.foreign_fetch_scopes);
1232 version->set_foreign_fetch_origins(data.foreign_fetch_origins);
1231 } 1233 }
1232 1234
1233 if (version->status() == ServiceWorkerVersion::ACTIVATED) 1235 if (version->status() == ServiceWorkerVersion::ACTIVATED)
1234 registration->SetActiveVersion(version); 1236 registration->SetActiveVersion(version);
1235 else if (version->status() == ServiceWorkerVersion::INSTALLED) 1237 else if (version->status() == ServiceWorkerVersion::INSTALLED)
1236 registration->SetWaitingVersion(version); 1238 registration->SetWaitingVersion(version);
1237 else 1239 else
1238 NOTREACHED(); 1240 NOTREACHED();
1239 1241
1240 return registration; 1242 return registration;
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after
1741 callback.Run(SERVICE_WORKER_ERROR_FAILED); 1743 callback.Run(SERVICE_WORKER_ERROR_FAILED);
1742 return; 1744 return;
1743 } 1745 }
1744 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully."; 1746 DVLOG(1) << "Deleted ServiceWorkerDiskCache successfully.";
1745 ServiceWorkerMetrics::RecordDeleteAndStartOverResult( 1747 ServiceWorkerMetrics::RecordDeleteAndStartOverResult(
1746 ServiceWorkerMetrics::DELETE_OK); 1748 ServiceWorkerMetrics::DELETE_OK);
1747 callback.Run(SERVICE_WORKER_OK); 1749 callback.Run(SERVICE_WORKER_OK);
1748 } 1750 }
1749 1751
1750 } // namespace content 1752 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698