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_request_handler.h" | 5 #include "content/browser/service_worker/service_worker_request_handler.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/macros.h" | 10 #include "base/macros.h" |
10 #include "content/browser/service_worker/service_worker_context_core.h" | 11 #include "content/browser/service_worker/service_worker_context_core.h" |
11 #include "content/browser/service_worker/service_worker_context_wrapper.h" | 12 #include "content/browser/service_worker/service_worker_context_wrapper.h" |
12 #include "content/browser/service_worker/service_worker_navigation_handle_core.h
" | 13 #include "content/browser/service_worker/service_worker_navigation_handle_core.h
" |
13 #include "content/browser/service_worker/service_worker_provider_host.h" | 14 #include "content/browser/service_worker/service_worker_provider_host.h" |
14 #include "content/browser/service_worker/service_worker_registration.h" | 15 #include "content/browser/service_worker/service_worker_registration.h" |
15 #include "content/browser/service_worker/service_worker_url_request_job.h" | 16 #include "content/browser/service_worker/service_worker_url_request_job.h" |
16 #include "content/common/resource_request_body.h" | 17 #include "content/common/resource_request_body.h" |
17 #include "content/common/service_worker/service_worker_types.h" | 18 #include "content/common/service_worker/service_worker_types.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 request, provider_host.get(), blob_storage_context, skip_service_worker, | 130 request, provider_host.get(), blob_storage_context, skip_service_worker, |
130 FETCH_REQUEST_MODE_SAME_ORIGIN, FETCH_CREDENTIALS_MODE_INCLUDE, | 131 FETCH_REQUEST_MODE_SAME_ORIGIN, FETCH_CREDENTIALS_MODE_INCLUDE, |
131 FetchRedirectMode::MANUAL_MODE, resource_type, request_context_type, | 132 FetchRedirectMode::MANUAL_MODE, resource_type, request_context_type, |
132 frame_type, body); | 133 frame_type, body); |
133 | 134 |
134 // Transfer ownership to the ServiceWorkerNavigationHandleCore. | 135 // Transfer ownership to the ServiceWorkerNavigationHandleCore. |
135 // In the case of a successful navigation, the SWProviderHost will be | 136 // In the case of a successful navigation, the SWProviderHost will be |
136 // transferred to its "final" destination in the OnProviderCreated handler. If | 137 // transferred to its "final" destination in the OnProviderCreated handler. If |
137 // the navigation fails, it will be destroyed along with the | 138 // the navigation fails, it will be destroyed along with the |
138 // ServiceWorkerNavigationHandleCore. | 139 // ServiceWorkerNavigationHandleCore. |
139 navigation_handle_core->DidPreCreateProviderHost(provider_host.Pass()); | 140 navigation_handle_core->DidPreCreateProviderHost(std::move(provider_host)); |
140 } | 141 } |
141 | 142 |
142 void ServiceWorkerRequestHandler::InitializeHandler( | 143 void ServiceWorkerRequestHandler::InitializeHandler( |
143 net::URLRequest* request, | 144 net::URLRequest* request, |
144 ServiceWorkerContextWrapper* context_wrapper, | 145 ServiceWorkerContextWrapper* context_wrapper, |
145 storage::BlobStorageContext* blob_storage_context, | 146 storage::BlobStorageContext* blob_storage_context, |
146 int process_id, | 147 int process_id, |
147 int provider_id, | 148 int provider_id, |
148 bool skip_service_worker, | 149 bool skip_service_worker, |
149 FetchRequestMode request_mode, | 150 FetchRequestMode request_mode, |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 DCHECK_EQ(provider_host_.get(), host_for_cross_site_transfer_.get()); | 211 DCHECK_EQ(provider_host_.get(), host_for_cross_site_transfer_.get()); |
211 } | 212 } |
212 | 213 |
213 void ServiceWorkerRequestHandler::CompleteCrossSiteTransfer( | 214 void ServiceWorkerRequestHandler::CompleteCrossSiteTransfer( |
214 int new_process_id, int new_provider_id) { | 215 int new_process_id, int new_provider_id) { |
215 CHECK(!IsBrowserSideNavigationEnabled()); | 216 CHECK(!IsBrowserSideNavigationEnabled()); |
216 if (!host_for_cross_site_transfer_.get() || !context_) | 217 if (!host_for_cross_site_transfer_.get() || !context_) |
217 return; | 218 return; |
218 DCHECK_EQ(provider_host_.get(), host_for_cross_site_transfer_.get()); | 219 DCHECK_EQ(provider_host_.get(), host_for_cross_site_transfer_.get()); |
219 context_->TransferProviderHostIn(new_process_id, new_provider_id, | 220 context_->TransferProviderHostIn(new_process_id, new_provider_id, |
220 host_for_cross_site_transfer_.Pass()); | 221 std::move(host_for_cross_site_transfer_)); |
221 DCHECK_EQ(provider_host_->provider_id(), new_provider_id); | 222 DCHECK_EQ(provider_host_->provider_id(), new_provider_id); |
222 } | 223 } |
223 | 224 |
224 void ServiceWorkerRequestHandler::MaybeCompleteCrossSiteTransferInOldProcess( | 225 void ServiceWorkerRequestHandler::MaybeCompleteCrossSiteTransferInOldProcess( |
225 int old_process_id) { | 226 int old_process_id) { |
226 CHECK(!IsBrowserSideNavigationEnabled()); | 227 CHECK(!IsBrowserSideNavigationEnabled()); |
227 if (!host_for_cross_site_transfer_.get() || !context_ || | 228 if (!host_for_cross_site_transfer_.get() || !context_ || |
228 old_process_id_ != old_process_id) { | 229 old_process_id_ != old_process_id) { |
229 return; | 230 return; |
230 } | 231 } |
(...skipping 10 matching lines...) Expand all Loading... |
241 ResourceType resource_type) | 242 ResourceType resource_type) |
242 : context_(context), | 243 : context_(context), |
243 provider_host_(provider_host), | 244 provider_host_(provider_host), |
244 blob_storage_context_(blob_storage_context), | 245 blob_storage_context_(blob_storage_context), |
245 resource_type_(resource_type), | 246 resource_type_(resource_type), |
246 old_process_id_(0), | 247 old_process_id_(0), |
247 old_provider_id_(kInvalidServiceWorkerProviderId) { | 248 old_provider_id_(kInvalidServiceWorkerProviderId) { |
248 } | 249 } |
249 | 250 |
250 } // namespace content | 251 } // namespace content |
OLD | NEW |