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

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

Issue 362183002: ServiceWorker: Set provider host document URL for no-cache load. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review update Created 6 years, 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_metrics.h" 8 #include "content/browser/service_worker/service_worker_metrics.h"
9 #include "content/browser/service_worker/service_worker_provider_host.h" 9 #include "content/browser/service_worker/service_worker_provider_host.h"
10 #include "content/browser/service_worker/service_worker_registration.h" 10 #include "content/browser/service_worker/service_worker_registration.h"
(...skipping 28 matching lines...) Expand all
39 if (is_main_resource_load_) 39 if (is_main_resource_load_)
40 provider_host_->active_version()->ScheduleUpdate(); 40 provider_host_->active_version()->ScheduleUpdate();
41 else 41 else
42 provider_host_->active_version()->DeferScheduledUpdate(); 42 provider_host_->active_version()->DeferScheduledUpdate();
43 } 43 }
44 } 44 }
45 45
46 net::URLRequestJob* ServiceWorkerControlleeRequestHandler::MaybeCreateJob( 46 net::URLRequestJob* ServiceWorkerControlleeRequestHandler::MaybeCreateJob(
47 net::URLRequest* request, 47 net::URLRequest* request,
48 net::NetworkDelegate* network_delegate) { 48 net::NetworkDelegate* network_delegate) {
49 if (!context_ || !provider_host_ || 49 if (!context_ || !provider_host_) {
50 request->load_flags() & net::LOAD_BYPASS_CACHE) {
51 // We can't do anything other than to fall back to network. 50 // We can't do anything other than to fall back to network.
52 job_ = NULL; 51 job_ = NULL;
53 return NULL; 52 return NULL;
54 } 53 }
55 54
55 if (request->load_flags() & net::LOAD_BYPASS_CACHE) {
56 if (is_main_resource_load_ && provider_host_) {
michaeln 2014/07/11 19:48:53 dont think we can get here if !provider_host_ so t
57 provider_host_->SetDocumentUrl(
58 net::SimplifyUrlForRequest(request->url()));
59 }
60 job_ = NULL;
61 return NULL;
62 }
63
56 // This may get called multiple times for original and redirect requests: 64 // This may get called multiple times for original and redirect requests:
57 // A. original request case: job_ is null, no previous location info. 65 // A. original request case: job_ is null, no previous location info.
58 // B. redirect or restarted request case: 66 // B. redirect or restarted request case:
59 // a) job_ is non-null if the previous location was forwarded to SW. 67 // a) job_ is non-null if the previous location was forwarded to SW.
60 // b) job_ is null if the previous location was fallback. 68 // b) job_ is null if the previous location was fallback.
61 // c) job_ is non-null if additional restart was required to fall back. 69 // c) job_ is non-null if additional restart was required to fall back.
62 70
63 // We've come here by restart, we already have original request and it 71 // We've come here by restart, we already have original request and it
64 // tells we should fallback to network. (Case B-c) 72 // tells we should fallback to network. (Case B-c)
65 if (job_.get() && job_->ShouldFallbackToNetwork()) { 73 if (job_.get() && job_->ShouldFallbackToNetwork()) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 } 136 }
129 137
130 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { 138 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() {
131 DCHECK(job_.get()); 139 DCHECK(job_.get());
132 DCHECK(context_); 140 DCHECK(context_);
133 DCHECK(provider_host_->active_version()); 141 DCHECK(provider_host_->active_version());
134 job_->ForwardToServiceWorker(); 142 job_->ForwardToServiceWorker();
135 } 143 }
136 144
137 } // namespace content 145 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698