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 b20943e3fe0383ebc9714547e46954590f0c58bb..c2f4ecb5c8bd746f450330006f5c8e8514b14b40 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -75,6 +75,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_holder.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" |
@@ -130,6 +131,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" |
@@ -652,6 +654,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"; |
@@ -894,16 +897,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 |
@@ -1092,6 +1095,9 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { |
mojo_child_connection_->service_registry_android()); |
#endif |
+ GetInterfaceRegistry()->AddInterface(base::Bind( |
+ &RenderProcessHostImpl::CreateURLLoaderFactory, base::Unretained(this))); |
+ |
GetContentClient()->browser()->ExposeInterfacesToRenderer( |
GetInterfaceRegistry(), this); |
} |
@@ -1105,6 +1111,12 @@ void RenderProcessHostImpl::CreateStoragePartitionService( |
} |
} |
+void RenderProcessHostImpl::CreateURLLoaderFactory( |
+ mojo::InterfaceRequest<mojom::URLLoaderFactory> request) { |
+ url_loader_factory_holder_.reset( |
+ new URLLoaderFactoryHolder(resource_message_filter_, std::move(request))); |
+} |
+ |
int RenderProcessHostImpl::GetNextRoutingID() { |
return widget_helper_->GetNextRoutingID(); |
} |
@@ -1859,6 +1871,7 @@ bool RenderProcessHostImpl::IgnoreInputEvents() const { |
} |
void RenderProcessHostImpl::Cleanup() { |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
// Keep the one renderer thread around forever in single process mode. |
if (run_renderer_in_process()) |
return; |
@@ -1942,6 +1955,7 @@ void RenderProcessHostImpl::Cleanup() { |
// The following members should be cleared in ProcessDied() as well! |
message_port_message_filter_ = NULL; |
+ url_loader_factory_holder_ = nullptr; |
RemoveUserData(kSessionStorageHolderKey); |
@@ -2460,6 +2474,7 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead, |
within_process_died_observer_ = false; |
message_port_message_filter_ = NULL; |
+ url_loader_factory_holder_ = nullptr; |
RemoveUserData(kSessionStorageHolderKey); |
IDMap<IPC::Listener>::iterator iter(&listeners_); |