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_url_request_job.h" | 5 #include "content/browser/service_worker/service_worker_url_request_job.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <limits> | 10 #include <limits> |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, | 202 base::WeakPtr<storage::BlobStorageContext> blob_storage_context, |
203 const ResourceContext* resource_context, | 203 const ResourceContext* resource_context, |
204 FetchRequestMode request_mode, | 204 FetchRequestMode request_mode, |
205 FetchCredentialsMode credentials_mode, | 205 FetchCredentialsMode credentials_mode, |
206 FetchRedirectMode redirect_mode, | 206 FetchRedirectMode redirect_mode, |
207 ResourceType resource_type, | 207 ResourceType resource_type, |
208 RequestContextType request_context_type, | 208 RequestContextType request_context_type, |
209 RequestContextFrameType frame_type, | 209 RequestContextFrameType frame_type, |
210 scoped_refptr<ResourceRequestBodyImpl> body, | 210 scoped_refptr<ResourceRequestBodyImpl> body, |
211 ServiceWorkerFetchType fetch_type, | 211 ServiceWorkerFetchType fetch_type, |
212 const MojoURLLoaderFactoryGetter& url_loader_factory_getter, | |
213 Delegate* delegate) | 212 Delegate* delegate) |
214 : net::URLRequestJob(request, network_delegate), | 213 : net::URLRequestJob(request, network_delegate), |
215 delegate_(delegate), | 214 delegate_(delegate), |
216 response_type_(NOT_DETERMINED), | 215 response_type_(NOT_DETERMINED), |
217 is_started_(false), | 216 is_started_(false), |
218 service_worker_response_type_(blink::WebServiceWorkerResponseTypeDefault), | 217 service_worker_response_type_(blink::WebServiceWorkerResponseTypeDefault), |
219 client_id_(client_id), | 218 client_id_(client_id), |
220 blob_storage_context_(blob_storage_context), | 219 blob_storage_context_(blob_storage_context), |
221 resource_context_(resource_context), | 220 resource_context_(resource_context), |
222 request_mode_(request_mode), | 221 request_mode_(request_mode), |
223 credentials_mode_(credentials_mode), | 222 credentials_mode_(credentials_mode), |
224 redirect_mode_(redirect_mode), | 223 redirect_mode_(redirect_mode), |
225 resource_type_(resource_type), | 224 resource_type_(resource_type), |
226 request_context_type_(request_context_type), | 225 request_context_type_(request_context_type), |
227 frame_type_(frame_type), | 226 frame_type_(frame_type), |
228 fall_back_required_(false), | 227 fall_back_required_(false), |
229 body_(body), | 228 body_(body), |
230 fetch_type_(fetch_type), | 229 fetch_type_(fetch_type), |
231 url_loader_factory_getter_(url_loader_factory_getter), | |
232 weak_factory_(this) { | 230 weak_factory_(this) { |
233 DCHECK(delegate_) << "ServiceWorkerURLRequestJob requires a delegate"; | 231 DCHECK(delegate_) << "ServiceWorkerURLRequestJob requires a delegate"; |
234 } | 232 } |
235 | 233 |
236 ServiceWorkerURLRequestJob::~ServiceWorkerURLRequestJob() { | 234 ServiceWorkerURLRequestJob::~ServiceWorkerURLRequestJob() { |
237 stream_reader_.reset(); | 235 stream_reader_.reset(); |
238 blob_construction_waiter_.reset(); | 236 blob_construction_waiter_.reset(); |
239 | 237 |
240 if (!ShouldRecordResult()) | 238 if (!ShouldRecordResult()) |
241 return; | 239 return; |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 initial_worker_status_ = active_worker->running_status(); | 886 initial_worker_status_ = active_worker->running_status(); |
889 | 887 |
890 DCHECK(!fetch_dispatcher_); | 888 DCHECK(!fetch_dispatcher_); |
891 fetch_dispatcher_.reset(new ServiceWorkerFetchDispatcher( | 889 fetch_dispatcher_.reset(new ServiceWorkerFetchDispatcher( |
892 CreateFetchRequest(), active_worker, resource_type_, request()->net_log(), | 890 CreateFetchRequest(), active_worker, resource_type_, request()->net_log(), |
893 base::Bind(&ServiceWorkerURLRequestJob::DidPrepareFetchEvent, | 891 base::Bind(&ServiceWorkerURLRequestJob::DidPrepareFetchEvent, |
894 weak_factory_.GetWeakPtr(), active_worker), | 892 weak_factory_.GetWeakPtr(), active_worker), |
895 base::Bind(&ServiceWorkerURLRequestJob::DidDispatchFetchEvent, | 893 base::Bind(&ServiceWorkerURLRequestJob::DidDispatchFetchEvent, |
896 weak_factory_.GetWeakPtr()))); | 894 weak_factory_.GetWeakPtr()))); |
897 worker_start_time_ = base::TimeTicks::Now(); | 895 worker_start_time_ = base::TimeTicks::Now(); |
898 fetch_dispatcher_->MaybeStartNavigationPreload(request(), | 896 fetch_dispatcher_->MaybeStartNavigationPreload(request()); |
899 url_loader_factory_getter_); | |
900 fetch_dispatcher_->Run(); | 897 fetch_dispatcher_->Run(); |
901 } | 898 } |
902 | 899 |
903 } // namespace content | 900 } // namespace content |
OLD | NEW |