| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/loader/url_loader_factory_impl.h" | 5 #include "content/browser/loader/url_loader_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 8 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 9 #include "content/browser/loader/resource_requester_info.h" | 9 #include "content/browser/loader/resource_requester_info.h" |
| 10 #include "content/common/resource_request.h" | 10 #include "content/common/resource_request.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 URLLoaderFactoryImpl::~URLLoaderFactoryImpl() { | 45 URLLoaderFactoryImpl::~URLLoaderFactoryImpl() { |
| 46 DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); | 46 DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void URLLoaderFactoryImpl::CreateLoaderAndStart( | 49 void URLLoaderFactoryImpl::CreateLoaderAndStart( |
| 50 mojom::URLLoaderAssociatedRequest request, | 50 mojom::URLLoaderAssociatedRequest request, |
| 51 int32_t routing_id, | 51 int32_t routing_id, |
| 52 int32_t request_id, | 52 int32_t request_id, |
| 53 uint32_t options, | 53 uint32_t options, |
| 54 const ResourceRequest& url_request, | 54 const ResourceRequest& url_request, |
| 55 mojom::URLLoaderClientPtr client) { | 55 mojom::URLLoaderClientPtr client, |
| 56 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation) { |
| 56 DCHECK_EQ(options, mojom::kURLLoadOptionNone); | 57 DCHECK_EQ(options, mojom::kURLLoadOptionNone); |
| 57 CreateLoaderAndStart(requester_info_.get(), std::move(request), routing_id, | 58 CreateLoaderAndStart( |
| 58 request_id, url_request, std::move(client)); | 59 requester_info_.get(), std::move(request), routing_id, request_id, |
| 60 url_request, std::move(client), |
| 61 static_cast<net::NetworkTrafficAnnotationTag>(traffic_annotation)); |
| 59 } | 62 } |
| 60 | 63 |
| 61 void URLLoaderFactoryImpl::SyncLoad(int32_t routing_id, | 64 void URLLoaderFactoryImpl::SyncLoad(int32_t routing_id, |
| 62 int32_t request_id, | 65 int32_t request_id, |
| 63 const ResourceRequest& url_request, | 66 const ResourceRequest& url_request, |
| 64 SyncLoadCallback callback) { | 67 SyncLoadCallback callback) { |
| 65 SyncLoad(requester_info_.get(), routing_id, request_id, url_request, | 68 SyncLoad(requester_info_.get(), routing_id, request_id, url_request, |
| 66 std::move(callback)); | 69 std::move(callback)); |
| 67 } | 70 } |
| 68 | 71 |
| 69 // static | 72 // static |
| 70 void URLLoaderFactoryImpl::CreateLoaderAndStart( | 73 void URLLoaderFactoryImpl::CreateLoaderAndStart( |
| 71 ResourceRequesterInfo* requester_info, | 74 ResourceRequesterInfo* requester_info, |
| 72 mojom::URLLoaderAssociatedRequest request, | 75 mojom::URLLoaderAssociatedRequest request, |
| 73 int32_t routing_id, | 76 int32_t routing_id, |
| 74 int32_t request_id, | 77 int32_t request_id, |
| 75 const ResourceRequest& url_request, | 78 const ResourceRequest& url_request, |
| 76 mojom::URLLoaderClientPtr client) { | 79 mojom::URLLoaderClientPtr client, |
| 80 const net::NetworkTrafficAnnotationTag& traffic_annotation) { |
| 77 DCHECK(ResourceDispatcherHostImpl::Get() | 81 DCHECK(ResourceDispatcherHostImpl::Get() |
| 78 ->io_thread_task_runner() | 82 ->io_thread_task_runner() |
| 79 ->BelongsToCurrentThread()); | 83 ->BelongsToCurrentThread()); |
| 80 | 84 |
| 81 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 85 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
| 82 rdh->OnRequestResourceWithMojo(requester_info, routing_id, request_id, | 86 rdh->OnRequestResourceWithMojo(requester_info, routing_id, request_id, |
| 83 url_request, std::move(request), | 87 url_request, std::move(request), |
| 84 std::move(client)); | 88 std::move(client)); |
| 85 } | 89 } |
| 86 | 90 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 103 void URLLoaderFactoryImpl::Create( | 107 void URLLoaderFactoryImpl::Create( |
| 104 scoped_refptr<ResourceRequesterInfo> requester_info, | 108 scoped_refptr<ResourceRequesterInfo> requester_info, |
| 105 mojo::InterfaceRequest<mojom::URLLoaderFactory> request, | 109 mojo::InterfaceRequest<mojom::URLLoaderFactory> request, |
| 106 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner) { | 110 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread_runner) { |
| 107 mojo::MakeStrongBinding(base::WrapUnique(new URLLoaderFactoryImpl( | 111 mojo::MakeStrongBinding(base::WrapUnique(new URLLoaderFactoryImpl( |
| 108 std::move(requester_info), io_thread_runner)), | 112 std::move(requester_info), io_thread_runner)), |
| 109 std::move(request)); | 113 std::move(request)); |
| 110 } | 114 } |
| 111 | 115 |
| 112 } // namespace content | 116 } // namespace content |
| OLD | NEW |