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

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

Issue 527713002: [ServiceWorker] Introduce skip_service_worker flag and remove LOAD_BYPASS_CACHE check. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Introduce skip_service_worker flag Created 6 years, 3 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
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698