| 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/child/web_url_loader_impl.h" | 5 #include "content/child/web_url_loader_impl.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 620 // browser. This should not happen. | 620 // browser. This should not happen. |
| 621 // TODO(arthursonzogni): Remove this when the root cause for | 621 // TODO(arthursonzogni): Remove this when the root cause for |
| 622 // https://crbug.com/705508 is found. | 622 // https://crbug.com/705508 is found. |
| 623 if (IsBrowserSideNavigationEnabled() && | 623 if (IsBrowserSideNavigationEnabled() && |
| 624 IsResourceTypeFrame(resource_request->resource_type) && | 624 IsResourceTypeFrame(resource_request->resource_type) && |
| 625 !resource_request->resource_body_stream_url.SchemeIs(url::kBlobScheme) && | 625 !resource_request->resource_body_stream_url.SchemeIs(url::kBlobScheme) && |
| 626 !consumer_handle.is_valid()) { | 626 !consumer_handle.is_valid()) { |
| 627 base::debug::DumpWithoutCrashing(); | 627 base::debug::DumpWithoutCrashing(); |
| 628 } | 628 } |
| 629 | 629 |
| 630 const RequestExtraData empty_extra_data; | 630 RequestExtraData empty_extra_data; |
| 631 const RequestExtraData* extra_data; | 631 RequestExtraData* extra_data; |
| 632 if (request.GetExtraData()) | 632 if (request.GetExtraData()) |
| 633 extra_data = static_cast<RequestExtraData*>(request.GetExtraData()); | 633 extra_data = static_cast<RequestExtraData*>(request.GetExtraData()); |
| 634 else | 634 else |
| 635 extra_data = &empty_extra_data; | 635 extra_data = &empty_extra_data; |
| 636 extra_data->CopyToResourceRequest(resource_request.get()); | 636 extra_data->CopyToResourceRequest(resource_request.get()); |
| 637 if (extra_data->url_loader_factory_override()) | 637 if (extra_data->url_loader_factory_override()) |
| 638 url_loader_factory_ = extra_data->url_loader_factory_override(); | 638 url_loader_factory_ = extra_data->url_loader_factory_override(); |
| 639 | 639 |
| 640 if (sync_load_response) { | 640 if (sync_load_response) { |
| 641 DCHECK(defers_loading_ == NOT_DEFERRING); | 641 DCHECK(defers_loading_ == NOT_DEFERRING); |
| 642 resource_dispatcher_->StartSync( | 642 resource_dispatcher_->StartSync( |
| 643 std::move(resource_request), request.RequestorID(), sync_load_response, | 643 std::move(resource_request), request.RequestorID(), sync_load_response, |
| 644 request.GetLoadingIPCType(), url_loader_factory_); | 644 request.GetLoadingIPCType(), url_loader_factory_, |
| 645 std::move(extra_data->url_loader_throttles())); |
| 645 return; | 646 return; |
| 646 } | 647 } |
| 647 | 648 |
| 648 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Start", this, | 649 TRACE_EVENT_WITH_FLOW0("loading", "WebURLLoaderImpl::Context::Start", this, |
| 649 TRACE_EVENT_FLAG_FLOW_OUT); | 650 TRACE_EVENT_FLAG_FLOW_OUT); |
| 650 request_id_ = resource_dispatcher_->StartAsync( | 651 request_id_ = resource_dispatcher_->StartAsync( |
| 651 std::move(resource_request), request.RequestorID(), task_runner_, | 652 std::move(resource_request), request.RequestorID(), task_runner_, |
| 652 extra_data->frame_origin(), | 653 extra_data->frame_origin(), |
| 653 base::MakeUnique<WebURLLoaderImpl::RequestPeerImpl>(this), | 654 base::MakeUnique<WebURLLoaderImpl::RequestPeerImpl>(this), |
| 654 request.GetLoadingIPCType(), url_loader_factory_, | 655 request.GetLoadingIPCType(), url_loader_factory_, |
| 656 std::move(extra_data->url_loader_throttles()), |
| 655 std::move(consumer_handle)); | 657 std::move(consumer_handle)); |
| 656 | 658 |
| 657 if (defers_loading_ != NOT_DEFERRING) | 659 if (defers_loading_ != NOT_DEFERRING) |
| 658 resource_dispatcher_->SetDefersLoading(request_id_, true); | 660 resource_dispatcher_->SetDefersLoading(request_id_, true); |
| 659 } | 661 } |
| 660 | 662 |
| 661 void WebURLLoaderImpl::Context::SetTaskRunner( | 663 void WebURLLoaderImpl::Context::SetTaskRunner( |
| 662 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { | 664 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { |
| 663 task_runner_ = task_runner; | 665 task_runner_ = task_runner; |
| 664 } | 666 } |
| (...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 int intra_priority_value) { | 1288 int intra_priority_value) { |
| 1287 context_->DidChangePriority(new_priority, intra_priority_value); | 1289 context_->DidChangePriority(new_priority, intra_priority_value); |
| 1288 } | 1290 } |
| 1289 | 1291 |
| 1290 void WebURLLoaderImpl::SetLoadingTaskRunner( | 1292 void WebURLLoaderImpl::SetLoadingTaskRunner( |
| 1291 base::SingleThreadTaskRunner* loading_task_runner) { | 1293 base::SingleThreadTaskRunner* loading_task_runner) { |
| 1292 context_->SetTaskRunner(loading_task_runner); | 1294 context_->SetTaskRunner(loading_task_runner); |
| 1293 } | 1295 } |
| 1294 | 1296 |
| 1295 } // namespace content | 1297 } // namespace content |
| OLD | NEW |