Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(442)

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1970693002: Use mojo for Chrome Loading, Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 49a1881cd35be094c8aa4c5cb6cb7155150bd976..ba8cfab9707f4a062c0ff14dc7c0a0fd8a2d93c9 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"
@@ -659,6 +661,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";
@@ -900,16 +903,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
@@ -1105,6 +1108,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);
}
@@ -1118,6 +1124,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();
}
@@ -1864,6 +1876,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;
@@ -1947,6 +1960,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);
@@ -2465,6 +2479,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_);

Powered by Google App Engine
This is Rietveld 408576698