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 <memory> | 7 #include <memory> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 if (!context_ || !provider_host_) { | 172 if (!context_ || !provider_host_) { |
173 // We can't do anything other than to fall back to network. | 173 // We can't do anything other than to fall back to network. |
174 std::move(factory_callback).Run(nullptr); | 174 std::move(factory_callback).Run(nullptr); |
175 return; | 175 return; |
176 } | 176 } |
177 | 177 |
178 // In fallback cases we basically 'forward' the request, so we should | 178 // In fallback cases we basically 'forward' the request, so we should |
179 // never see use_network_ gets true. | 179 // never see use_network_ gets true. |
180 DCHECK(!use_network_); | 180 DCHECK(!use_network_); |
181 | 181 |
182 url_job_ = | 182 url_job_ = base::MakeUnique<ServiceWorkerURLJobWrapper>( |
183 base::MakeUnique<ServiceWorkerURLJobWrapper>(std::move(factory_callback)); | 183 std::move(factory_callback), this, blob_storage_context_); |
184 | 184 |
185 resource_context_ = resource_context; | 185 resource_context_ = resource_context; |
186 | 186 |
187 PrepareForMainResource(resource_request.url, | 187 PrepareForMainResource(resource_request.url, |
188 resource_request.first_party_for_cookies); | 188 resource_request.first_party_for_cookies); |
189 | 189 |
190 if (url_job_->ShouldFallbackToNetwork()) { | 190 if (url_job_->ShouldFallbackToNetwork()) { |
191 // We're falling back to the next URLLoaderRequestHandler, forward | 191 // We're falling back to the next URLLoaderRequestHandler, forward |
192 // the request and clear job now. | 192 // the request and clear job now. |
193 url_job_->FallbackToNetwork(); | 193 url_job_->FallbackToNetwork(); |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 498 |
499 void ServiceWorkerControlleeRequestHandler::ClearJob() { | 499 void ServiceWorkerControlleeRequestHandler::ClearJob() { |
500 url_job_.reset(); | 500 url_job_.reset(); |
501 } | 501 } |
502 | 502 |
503 bool ServiceWorkerControlleeRequestHandler::JobWasCanceled() const { | 503 bool ServiceWorkerControlleeRequestHandler::JobWasCanceled() const { |
504 return !url_job_ || url_job_->WasCanceled(); | 504 return !url_job_ || url_job_->WasCanceled(); |
505 } | 505 } |
506 | 506 |
507 } // namespace content | 507 } // namespace content |
OLD | NEW |