OLD | NEW |
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 <string> | 7 #include <string> |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 173 |
174 void | 174 void |
175 ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource( | 175 ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource( |
176 ServiceWorkerStatusCode status, | 176 ServiceWorkerStatusCode status, |
177 const scoped_refptr<ServiceWorkerRegistration>& registration) { | 177 const scoped_refptr<ServiceWorkerRegistration>& registration) { |
178 // The job may have been canceled and then destroyed before this was invoked. | 178 // The job may have been canceled and then destroyed before this was invoked. |
179 if (!job_) | 179 if (!job_) |
180 return; | 180 return; |
181 | 181 |
182 const bool need_to_update = !force_update_started_ && registration && | 182 const bool need_to_update = !force_update_started_ && registration && |
183 registration->force_update_on_page_load(); | 183 context_->force_update_on_page_load(); |
184 | 184 |
185 if (provider_host_ && !need_to_update) | 185 if (provider_host_ && !need_to_update) |
186 provider_host_->SetAllowAssociation(true); | 186 provider_host_->SetAllowAssociation(true); |
187 if (status != SERVICE_WORKER_OK || !provider_host_ || !context_) { | 187 if (status != SERVICE_WORKER_OK || !provider_host_ || !context_) { |
188 job_->FallbackToNetwork(); | 188 job_->FallbackToNetwork(); |
189 TRACE_EVENT_ASYNC_END1( | 189 TRACE_EVENT_ASYNC_END1( |
190 "ServiceWorker", | 190 "ServiceWorker", |
191 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", | 191 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", |
192 job_.get(), | 192 job_.get(), |
193 "Status", status); | 193 "Status", status); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 void ServiceWorkerControlleeRequestHandler::ClearJob() { | 434 void ServiceWorkerControlleeRequestHandler::ClearJob() { |
435 job_.reset(); | 435 job_.reset(); |
436 was_fetched_via_service_worker_ = false; | 436 was_fetched_via_service_worker_ = false; |
437 was_fallback_required_ = false; | 437 was_fallback_required_ = false; |
438 original_url_via_service_worker_ = GURL(); | 438 original_url_via_service_worker_ = GURL(); |
439 response_type_via_service_worker_ = | 439 response_type_via_service_worker_ = |
440 blink::WebServiceWorkerResponseTypeDefault; | 440 blink::WebServiceWorkerResponseTypeDefault; |
441 } | 441 } |
442 | 442 |
443 } // namespace content | 443 } // namespace content |
OLD | NEW |