Chromium Code Reviews| Index: content/browser/loader/url_loader_factory_impl.cc |
| diff --git a/content/browser/loader/url_loader_factory_impl.cc b/content/browser/loader/url_loader_factory_impl.cc |
| index 7b11666452e2683045457b408c5fb466e06c4243..5b8324a6573cf84093cab0feda7c732e098371c9 100644 |
| --- a/content/browser/loader/url_loader_factory_impl.cc |
| +++ b/content/browser/loader/url_loader_factory_impl.cc |
| @@ -13,6 +13,23 @@ |
| namespace content { |
| +namespace { |
| + |
| +void DispatchSyncLoadResult( |
| + const URLLoaderFactoryImpl::SyncLoadCallback& callback, |
| + const SyncLoadResult* result) { |
| + if (!result) { |
|
kinuko
2016/10/13 05:36:00
sorry, could you teach me when this could happen?
tzik
2016/10/13 06:31:26
This can be called from the dtor of SyncResourceHa
kinuko
2016/10/13 11:39:01
I see thanks. Maybe worth commenting that result
tzik
2016/10/14 08:02:31
Done.
|
| + SyncLoadResult failure; |
| + failure.error_code = net::ERR_FAILED; |
| + callback.Run(failure); |
| + return; |
| + } |
| + |
| + callback.Run(*result); |
| +} |
| + |
| +} // namespace |
| + |
| URLLoaderFactoryImpl::URLLoaderFactoryImpl( |
| scoped_refptr<ResourceMessageFilter> resource_message_filter) |
| : resource_message_filter_(std::move(resource_message_filter)) { |
| @@ -38,6 +55,19 @@ void URLLoaderFactoryImpl::CreateLoaderAndStart( |
| resource_message_filter_.get()); |
| } |
| +void URLLoaderFactoryImpl::SyncLoad(int32_t routing_id, |
| + int32_t request_id, |
| + const ResourceRequest& url_request, |
| + const SyncLoadCallback& callback) { |
| + DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| + |
| + SyncLoadResult result; |
|
kinuko
2016/10/13 05:36:00
Do we need this line?
tzik
2016/10/13 06:31:26
Oops. No, it's needed. Removed.
|
| + ResourceDispatcherHostImpl* rdh = ResourceDispatcherHostImpl::Get(); |
| + rdh->OnSyncLoadWithMojo(routing_id, request_id, url_request, |
| + resource_message_filter_.get(), |
| + base::Bind(&DispatchSyncLoadResult, callback)); |
| +} |
| + |
| void URLLoaderFactoryImpl::Create( |
| scoped_refptr<ResourceMessageFilter> filter, |
| mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { |