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

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

Issue 501453002: Decouple script_url from ServiceWorkerRegistration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync after major collision Created 6 years, 4 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_version.cc
diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
index 161b89489a55a96e88365f061a00337245f047c0..60923e17d8edae7c4c5b057156cd93fcc31fda0d 100644
--- a/content/browser/service_worker/service_worker_version.cc
+++ b/content/browser/service_worker/service_worker_version.cc
@@ -91,10 +91,12 @@ void RunErrorFetchCallback(const ServiceWorkerVersion::FetchCallback& callback,
ServiceWorkerVersion::ServiceWorkerVersion(
ServiceWorkerRegistration* registration,
+ const GURL& script_url,
int64 version_id,
base::WeakPtr<ServiceWorkerContextCore> context)
: version_id_(version_id),
registration_id_(kInvalidServiceWorkerVersionId),
+ script_url_(script_url),
status_(NEW),
context_(context),
script_cache_map_(this, context),
@@ -104,7 +106,6 @@ ServiceWorkerVersion::ServiceWorkerVersion(
DCHECK(registration);
if (registration) {
registration_id_ = registration->id();
- script_url_ = registration->script_url();
scope_ = registration->pattern();
}
context_->AddLiveVersion(this);
@@ -151,6 +152,7 @@ ServiceWorkerVersionInfo ServiceWorkerVersion::GetInfo() {
return ServiceWorkerVersionInfo(
running_status(),
status(),
+ script_url(),
version_id(),
embedded_worker()->process_id(),
embedded_worker()->thread_id(),
@@ -226,7 +228,7 @@ void ServiceWorkerVersion::StartUpdate() {
return;
ServiceWorkerRegistration* registration =
context_->GetLiveRegistration(registration_id_);
- if (!registration)
+ if (!registration || !registration->GetNewestVersion())
return;
context_->UpdateServiceWorker(registration);
}

Powered by Google App Engine
This is Rietveld 408576698