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 "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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 | 48 |
49 net::URLRequestJob* ServiceWorkerControlleeRequestHandler::MaybeCreateJob( | 49 net::URLRequestJob* ServiceWorkerControlleeRequestHandler::MaybeCreateJob( |
50 net::URLRequest* request, | 50 net::URLRequest* request, |
51 net::NetworkDelegate* network_delegate) { | 51 net::NetworkDelegate* network_delegate) { |
52 if (!context_ || !provider_host_) { | 52 if (!context_ || !provider_host_) { |
53 // We can't do anything other than to fall back to network. | 53 // We can't do anything other than to fall back to network. |
54 job_ = NULL; | 54 job_ = NULL; |
55 return NULL; | 55 return NULL; |
56 } | 56 } |
57 | 57 |
58 if (request->load_flags() & net::LOAD_BYPASS_CACHE) { | |
59 if (is_main_resource_load_) { | |
60 provider_host_->SetDocumentUrl( | |
michaeln
2014/09/03 20:18:58
this change puts the browser side into an odd unex
| |
61 net::SimplifyUrlForRequest(request->url())); | |
62 } | |
63 job_ = NULL; | |
64 return NULL; | |
65 } | |
66 | |
67 // This may get called multiple times for original and redirect requests: | 58 // This may get called multiple times for original and redirect requests: |
68 // A. original request case: job_ is null, no previous location info. | 59 // A. original request case: job_ is null, no previous location info. |
69 // B. redirect or restarted request case: | 60 // B. redirect or restarted request case: |
70 // a) job_ is non-null if the previous location was forwarded to SW. | 61 // a) job_ is non-null if the previous location was forwarded to SW. |
71 // b) job_ is null if the previous location was fallback. | 62 // b) job_ is null if the previous location was fallback. |
72 // c) job_ is non-null if additional restart was required to fall back. | 63 // c) job_ is non-null if additional restart was required to fall back. |
73 | 64 |
74 // We've come here by restart, we already have original request and it | 65 // We've come here by restart, we already have original request and it |
75 // tells we should fallback to network. (Case B-c) | 66 // tells we should fallback to network. (Case B-c) |
76 if (job_.get() && job_->ShouldFallbackToNetwork()) { | 67 if (job_.get() && job_->ShouldFallbackToNetwork()) { |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 } | 176 } |
186 | 177 |
187 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { | 178 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { |
188 DCHECK(job_.get()); | 179 DCHECK(job_.get()); |
189 DCHECK(context_); | 180 DCHECK(context_); |
190 DCHECK(provider_host_->active_version()); | 181 DCHECK(provider_host_->active_version()); |
191 job_->ForwardToServiceWorker(); | 182 job_->ForwardToServiceWorker(); |
192 } | 183 } |
193 | 184 |
194 } // namespace content | 185 } // namespace content |
OLD | NEW |