Index: content/browser/renderer_host/render_process_host_impl.cc |
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc |
index 00984f7a1b5f09dce5244884ee5cbc96b9855ff5..04bc34ee03a6e90ea25c2c97b9ca6a0385bcc37f 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -77,6 +77,7 @@ |
#include "content/browser/indexed_db/indexed_db_dispatcher_host.h" |
#include "content/browser/loader/resource_message_filter.h" |
#include "content/browser/loader/resource_scheduler_filter.h" |
+#include "content/browser/loader/url_loader_factory_impl.h" |
#include "content/browser/media/capture/audio_mirroring_manager.h" |
#include "content/browser/media/capture/image_capture_impl.h" |
#include "content/browser/media/media_internals.h" |
@@ -131,6 +132,7 @@ |
#include "content/common/render_process_messages.h" |
#include "content/common/resource_messages.h" |
#include "content/common/site_isolation_policy.h" |
+#include "content/common/url_loader_factory.mojom.h" |
#include "content/common/view_messages.h" |
#include "content/public/browser/browser_context.h" |
#include "content/public/browser/browser_thread.h" |
@@ -648,6 +650,7 @@ void RenderProcessHostImpl::RegisterRendererMainThreadFactory( |
} |
RenderProcessHostImpl::~RenderProcessHostImpl() { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
#ifndef NDEBUG |
DCHECK(is_self_deleted_) |
<< "RenderProcessHostImpl is destroyed by something other than itself"; |
@@ -875,16 +878,16 @@ void RenderProcessHostImpl::CreateMessageFilters() { |
scoped_refptr<ChromeBlobStorageContext> blob_storage_context = |
ChromeBlobStorageContext::GetFor(browser_context); |
- ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( |
+ resource_message_filter_ = new ResourceMessageFilter( |
GetID(), PROCESS_TYPE_RENDERER, |
- storage_partition_impl_->GetAppCacheService(), |
- blob_storage_context.get(), |
+ storage_partition_impl_->GetAppCacheService(), blob_storage_context.get(), |
storage_partition_impl_->GetFileSystemContext(), |
storage_partition_impl_->GetServiceWorkerContext(), |
storage_partition_impl_->GetHostZoomLevelContext(), |
get_contexts_callback); |
- AddFilter(resource_message_filter); |
+ AddFilter(resource_message_filter_.get()); |
+ |
MediaStreamManager* media_stream_manager = |
BrowserMainLoop::GetInstance()->media_stream_manager(); |
// The AudioInputRendererHost and AudioRendererHost needs to be available for |
@@ -1099,6 +1102,9 @@ void RenderProcessHostImpl::RegisterMojoServices() { |
mojo_application_host_->service_registry_android()); |
#endif |
+ mojo_application_host_->service_registry()->AddService(base::Bind( |
+ &RenderProcessHostImpl::CreateURLLoaderFactory, base::Unretained(this))); |
+ |
GetContentClient()->browser()->RegisterRenderProcessMojoServices( |
mojo_application_host_->service_registry()); |
} |
@@ -1112,6 +1118,12 @@ void RenderProcessHostImpl::CreateStoragePartitionService( |
} |
} |
+void RenderProcessHostImpl::CreateURLLoaderFactory( |
+ mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { |
+ url_loader_factory_.reset( |
+ new URLLoaderFactoryImpl(resource_message_filter_, std::move(request))); |
+} |
+ |
int RenderProcessHostImpl::GetNextRoutingID() { |
return widget_helper_->GetNextRoutingID(); |
} |
@@ -1826,6 +1838,7 @@ bool RenderProcessHostImpl::IgnoreInputEvents() const { |
} |
void RenderProcessHostImpl::Cleanup() { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
// If within_process_died_observer_ is true, one of our observers performed an |
// action that caused us to die (e.g. http://crbug.com/339504). Therefore, |
// delay the destruction until all of the observer callbacks have been made, |
@@ -1905,6 +1918,7 @@ void RenderProcessHostImpl::Cleanup() { |
// The following members should be cleared in ProcessDied() as well! |
message_port_message_filter_ = NULL; |
+ url_loader_factory_ = nullptr; |
RemoveUserData(kSessionStorageHolderKey); |
@@ -2428,6 +2442,7 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead, |
within_process_died_observer_ = false; |
message_port_message_filter_ = NULL; |
+ url_loader_factory_ = nullptr; |
RemoveUserData(kSessionStorageHolderKey); |
IDMap<IPC::Listener>::iterator iter(&listeners_); |