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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 | 44 |
45 URLLoaderFactoryImpl::~URLLoaderFactoryImpl() { | 45 URLLoaderFactoryImpl::~URLLoaderFactoryImpl() { |
46 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 46 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
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 const ResourceRequest& url_request, | 53 const ResourceRequest& url_request, |
54 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info) { | 54 mojom::URLLoaderClientPtr client) { |
55 CreateLoaderAndStart(requester_info_.get(), std::move(request), routing_id, | 55 CreateLoaderAndStart(requester_info_.get(), std::move(request), routing_id, |
56 request_id, url_request, std::move(client_ptr_info)); | 56 request_id, url_request, std::move(client)); |
57 } | 57 } |
58 | 58 |
59 void URLLoaderFactoryImpl::SyncLoad(int32_t routing_id, | 59 void URLLoaderFactoryImpl::SyncLoad(int32_t routing_id, |
60 int32_t request_id, | 60 int32_t request_id, |
61 const ResourceRequest& url_request, | 61 const ResourceRequest& url_request, |
62 const SyncLoadCallback& callback) { | 62 const SyncLoadCallback& callback) { |
63 SyncLoad(requester_info_.get(), routing_id, request_id, url_request, | 63 SyncLoad(requester_info_.get(), routing_id, request_id, url_request, |
64 callback); | 64 callback); |
65 } | 65 } |
66 | 66 |
67 // static | 67 // static |
68 void URLLoaderFactoryImpl::CreateLoaderAndStart( | 68 void URLLoaderFactoryImpl::CreateLoaderAndStart( |
69 ResourceRequesterInfo* requester_info, | 69 ResourceRequesterInfo* requester_info, |
70 mojom::URLLoaderAssociatedRequest request, | 70 mojom::URLLoaderAssociatedRequest request, |
71 int32_t routing_id, | 71 int32_t routing_id, |
72 int32_t request_id, | 72 int32_t request_id, |
73 const ResourceRequest& url_request, | 73 const ResourceRequest& url_request, |
74 mojom::URLLoaderClientAssociatedPtrInfo client_ptr_info) { | 74 mojom::URLLoaderClientPtr client) { |
75 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 75 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
76 | 76 |
77 mojom::URLLoaderClientAssociatedPtr client; | |
78 client.Bind(std::move(client_ptr_info)); | |
79 | |
80 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 77 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
81 rdh->OnRequestResourceWithMojo(requester_info, routing_id, request_id, | 78 rdh->OnRequestResourceWithMojo(requester_info, routing_id, request_id, |
82 url_request, std::move(request), | 79 url_request, std::move(request), |
83 std::move(client)); | 80 std::move(client)); |
84 } | 81 } |
85 | 82 |
86 // static | 83 // static |
87 void URLLoaderFactoryImpl::SyncLoad(ResourceRequesterInfo* requester_info, | 84 void URLLoaderFactoryImpl::SyncLoad(ResourceRequesterInfo* requester_info, |
88 int32_t routing_id, | 85 int32_t routing_id, |
89 int32_t request_id, | 86 int32_t request_id, |
90 const ResourceRequest& url_request, | 87 const ResourceRequest& url_request, |
91 const SyncLoadCallback& callback) { | 88 const SyncLoadCallback& callback) { |
92 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 89 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
93 | 90 |
94 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); | 91 ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
95 rdh->OnSyncLoadWithMojo(requester_info, routing_id, request_id, url_request, | 92 rdh->OnSyncLoadWithMojo(requester_info, routing_id, request_id, url_request, |
96 base::Bind(&DispatchSyncLoadResult, callback)); | 93 base::Bind(&DispatchSyncLoadResult, callback)); |
97 } | 94 } |
98 | 95 |
99 void URLLoaderFactoryImpl::Create( | 96 void URLLoaderFactoryImpl::Create( |
100 scoped_refptr<ResourceRequesterInfo> requester_info, | 97 scoped_refptr<ResourceRequesterInfo> requester_info, |
101 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { | 98 mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { |
102 mojo::MakeStrongBinding( | 99 mojo::MakeStrongBinding( |
103 base::WrapUnique(new URLLoaderFactoryImpl(std::move(requester_info))), | 100 base::WrapUnique(new URLLoaderFactoryImpl(std::move(requester_info))), |
104 std::move(request)); | 101 std::move(request)); |
105 } | 102 } |
106 | 103 |
107 } // namespace content | 104 } // namespace content |
OLD | NEW |