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

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: rebase Created 4 years, 4 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 2dcd82dc71506163902e85e97735a53a036b891b..9f364c424373f57d63e41adcd452fc51e2dd704a 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -78,6 +78,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"
@@ -133,6 +134,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"
@@ -655,6 +657,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
@@ -1113,6 +1116,9 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() {
mojo_child_connection_->interface_registry_android());
#endif
+ GetInterfaceRegistry()->AddInterface(base::Bind(
+ &RenderProcessHostImpl::CreateURLLoaderFactory, base::Unretained(this)));
+
GetContentClient()->browser()->ExposeInterfacesToRenderer(
GetInterfaceRegistry(), this);
}
@@ -1126,6 +1132,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);
@@ -2447,6 +2461,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