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

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

Issue 309453002: ServiceWorker: Rename 'pending version' to 'installing' or 'waiting' (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 6 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 | Annotate | Revision Log
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_controllee_request_handl er.h" 5 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h"
6 6
7 #include "content/browser/service_worker/service_worker_context_core.h" 7 #include "content/browser/service_worker/service_worker_context_core.h"
8 #include "content/browser/service_worker/service_worker_provider_host.h" 8 #include "content/browser/service_worker/service_worker_provider_host.h"
9 #include "content/browser/service_worker/service_worker_registration.h" 9 #include "content/browser/service_worker/service_worker_registration.h"
10 #include "content/browser/service_worker/service_worker_url_request_job.h" 10 #include "content/browser/service_worker/service_worker_url_request_job.h"
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 return job_.get(); 70 return job_.get();
71 } 71 }
72 72
73 void ServiceWorkerControlleeRequestHandler::PrepareForMainResource( 73 void ServiceWorkerControlleeRequestHandler::PrepareForMainResource(
74 const GURL& url) { 74 const GURL& url) {
75 DCHECK(job_.get()); 75 DCHECK(job_.get());
76 DCHECK(context_); 76 DCHECK(context_);
77 // The corresponding provider_host may already have associate version in 77 // The corresponding provider_host may already have associate version in
78 // redirect case, unassociate it now. 78 // redirect case, unassociate it now.
79 provider_host_->SetActiveVersion(NULL); 79 provider_host_->SetActiveVersion(NULL);
80 provider_host_->SetPendingVersion(NULL); 80 provider_host_->SetWaitingVersion(NULL);
81 provider_host_->set_document_url(url); 81 provider_host_->set_document_url(url);
82 context_->storage()->FindRegistrationForDocument( 82 context_->storage()->FindRegistrationForDocument(
83 url, 83 url,
84 base::Bind(&self::DidLookupRegistrationForMainResource, 84 base::Bind(&self::DidLookupRegistrationForMainResource,
85 weak_factory_.GetWeakPtr())); 85 weak_factory_.GetWeakPtr()));
86 } 86 }
87 87
88 void 88 void
89 ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource( 89 ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource(
90 ServiceWorkerStatusCode status, 90 ServiceWorkerStatusCode status,
91 const scoped_refptr<ServiceWorkerRegistration>& registration) { 91 const scoped_refptr<ServiceWorkerRegistration>& registration) {
92 DCHECK(job_.get()); 92 DCHECK(job_.get());
93 if (status != SERVICE_WORKER_OK || !registration->active_version()) { 93 if (status != SERVICE_WORKER_OK || !registration->active_version()) {
94 // No registration, or no active version for the registration is available. 94 // No registration, or no active version for the registration is available.
95 job_->FallbackToNetwork(); 95 job_->FallbackToNetwork();
96 return; 96 return;
97 } 97 }
98 // TODO(michaeln): should SetPendingVersion() even if no active version so 98 // TODO(michaeln): should SetWaitingVersion() even if no active version so
99 // so the versions in the pipeline (.installing, .waiting) show up in the 99 // so the versions in the pipeline (.installing, .waiting) show up in the
100 // attribute values. 100 // attribute values.
101 DCHECK(registration); 101 DCHECK(registration);
102 provider_host_->SetActiveVersion(registration->active_version()); 102 provider_host_->SetActiveVersion(registration->active_version());
103 provider_host_->SetPendingVersion(registration->pending_version()); 103 provider_host_->SetWaitingVersion(registration->waiting_version());
104 job_->ForwardToServiceWorker(); 104 job_->ForwardToServiceWorker();
105 } 105 }
106 106
107 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { 107 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() {
108 DCHECK(job_.get()); 108 DCHECK(job_.get());
109 DCHECK(context_); 109 DCHECK(context_);
110 DCHECK(provider_host_->active_version()); 110 DCHECK(provider_host_->active_version());
111 job_->ForwardToServiceWorker(); 111 job_->ForwardToServiceWorker();
112 } 112 }
113 113
114 } // namespace content 114 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698