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 db3e90ddded42ef7eb3ae08ccef0d9e35bb20a68..5a4606baac194535c12e27e9f4890620cc4bdbee 100644 |
--- a/content/browser/renderer_host/render_process_host_impl.cc |
+++ b/content/browser/renderer_host/render_process_host_impl.cc |
@@ -1358,8 +1358,12 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { |
base::Unretained( |
memory_instrumentation::CoordinatorImpl::GetInstance()))); |
- GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(), |
- this); |
+ associated_interfaces_.reset(new AssociatedInterfaceRegistryImpl()); |
+ GetContentClient()->browser()->ExposeInterfacesToRenderer( |
+ registry.get(), associated_interfaces_.get(), this); |
+ static_cast<AssociatedInterfaceRegistry*>(associated_interfaces_.get()) |
+ ->AddInterface(base::Bind(&RenderProcessHostImpl::BindRouteProvider, |
+ base::Unretained(this))); |
ServiceManagerConnection* service_manager_connection = |
BrowserContext::GetServiceManagerConnectionFor(browser_context_); |
@@ -1371,6 +1375,13 @@ void RenderProcessHostImpl::RegisterMojoInterfaces() { |
std::move(connection_filter)); |
} |
+void RenderProcessHostImpl::BindRouteProvider( |
+ mojom::RouteProviderAssociatedRequest request) { |
+ if (route_provider_binding_.is_bound()) |
+ return; |
+ route_provider_binding_.Bind(std::move(request)); |
+} |
+ |
void RenderProcessHostImpl::GetRoute( |
int32_t routing_id, |
mojom::AssociatedInterfaceProviderAssociatedRequest request) { |
@@ -2120,12 +2131,9 @@ bool RenderProcessHostImpl::OnMessageReceived(const IPC::Message& msg) { |
void RenderProcessHostImpl::OnAssociatedInterfaceRequest( |
const std::string& interface_name, |
mojo::ScopedInterfaceEndpointHandle handle) { |
- if (interface_name == mojom::RouteProvider::Name_) { |
- if (route_provider_binding_.is_bound()) |
- return; |
- mojom::RouteProviderAssociatedRequest request; |
- request.Bind(std::move(handle)); |
- route_provider_binding_.Bind(std::move(request)); |
+ if (associated_interfaces_ && |
+ associated_interfaces_->CanBindRequest(interface_name)) { |
+ associated_interfaces_->BindRequest(interface_name, std::move(handle)); |
} else { |
LOG(ERROR) << "Request for unknown Channel-associated interface: " |
<< interface_name; |
@@ -2785,6 +2793,7 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead, |
is_dead_ = true; |
if (route_provider_binding_.is_bound()) |
route_provider_binding_.Close(); |
+ associated_interfaces_.reset(); |
ResetChannelProxy(); |
UpdateProcessPriority(); |