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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2643183002: Convert ChromeViewHostMsg_UpdatedCacheStats to use mojo. (Closed)
Patch Set: Convert ChromeViewHostMsg_UpdatedCacheStats to use mojo. Created 3 years, 8 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Represents the browser side of the browser <--> renderer communication 5 // Represents the browser side of the browser <--> renderer communication
6 // channel. There will be one RenderProcessHost per renderer process. 6 // channel. There will be one RenderProcessHost per renderer process.
7 7
8 #include "content/browser/renderer_host/render_process_host_impl.h" 8 #include "content/browser/renderer_host/render_process_host_impl.h"
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1303 matching lines...) Expand 10 before | Expand all | Expand 10 after
1314 1314
1315 AddUIThreadInterface(registry.get(), base::Bind(&FieldTrialRecorder::Create)); 1315 AddUIThreadInterface(registry.get(), base::Bind(&FieldTrialRecorder::Create));
1316 1316
1317 AddUIThreadInterface( 1317 AddUIThreadInterface(
1318 registry.get(), 1318 registry.get(),
1319 base::Bind( 1319 base::Bind(
1320 &memory_instrumentation::CoordinatorImpl::BindCoordinatorRequest, 1320 &memory_instrumentation::CoordinatorImpl::BindCoordinatorRequest,
1321 base::Unretained( 1321 base::Unretained(
1322 memory_instrumentation::CoordinatorImpl::GetInstance()))); 1322 memory_instrumentation::CoordinatorImpl::GetInstance())));
1323 1323
1324 GetContentClient()->browser()->ExposeInterfacesToRenderer(registry.get(), 1324 associated_registry_.reset(new AssociatedInterfaceRegistryImpl());
1325 this); 1325 GetContentClient()->browser()->ExposeInterfacesToRenderer(
1326 registry.get(), associated_registry_.get(), this);
1327 // We say static_cast<AIR*>(ar.get())->Etc instead of just ar->Etc because
1328 // the ar field is an AIRImpl*, not an AIR*, and AIRImpl overloads the
1329 // AddInterface method to provide a 2-argument form, but we want the
1330 // templated helper 1-argument form defined on the abstract superclass.
1331 static_cast<AssociatedInterfaceRegistry*>(associated_registry_.get())
Ken Rockot(use gerrit already) 2017/04/20 15:49:42 nit: This is unfortunate, but I really don't think
nigeltao1 2017/04/21 00:07:54 Done.
1332 ->AddInterface(base::Bind(&RenderProcessHostImpl::BindRouteProvider,
1333 base::Unretained(this)));
1326 1334
1327 ServiceManagerConnection* service_manager_connection = 1335 ServiceManagerConnection* service_manager_connection =
1328 BrowserContext::GetServiceManagerConnectionFor(browser_context_); 1336 BrowserContext::GetServiceManagerConnectionFor(browser_context_);
1329 std::unique_ptr<ConnectionFilterImpl> connection_filter( 1337 std::unique_ptr<ConnectionFilterImpl> connection_filter(
1330 new ConnectionFilterImpl(child_connection_->child_identity(), 1338 new ConnectionFilterImpl(child_connection_->child_identity(),
1331 std::move(registry))); 1339 std::move(registry)));
1332 connection_filter_controller_ = connection_filter->controller(); 1340 connection_filter_controller_ = connection_filter->controller();
1333 connection_filter_id_ = service_manager_connection->AddConnectionFilter( 1341 connection_filter_id_ = service_manager_connection->AddConnectionFilter(
1334 std::move(connection_filter)); 1342 std::move(connection_filter));
1335 } 1343 }
1336 1344
1345 void RenderProcessHostImpl::BindRouteProvider(
1346 mojom::RouteProviderAssociatedRequest request) {
1347 if (route_provider_binding_.is_bound())
1348 return;
1349 route_provider_binding_.Bind(std::move(request));
1350 }
1351
1337 void RenderProcessHostImpl::GetRoute( 1352 void RenderProcessHostImpl::GetRoute(
1338 int32_t routing_id, 1353 int32_t routing_id,
1339 mojom::AssociatedInterfaceProviderAssociatedRequest request) { 1354 mojom::AssociatedInterfaceProviderAssociatedRequest request) {
1340 DCHECK(request.is_pending()); 1355 DCHECK(request.is_pending());
1341 associated_interface_provider_bindings_.AddBinding( 1356 associated_interface_provider_bindings_.AddBinding(
1342 this, std::move(request), routing_id); 1357 this, std::move(request), routing_id);
1343 } 1358 }
1344 1359
1345 void RenderProcessHostImpl::GetAssociatedInterface( 1360 void RenderProcessHostImpl::GetAssociatedInterface(
1346 const std::string& name, 1361 const std::string& name,
(...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after
2072 Send(reply); 2087 Send(reply);
2073 } 2088 }
2074 return true; 2089 return true;
2075 } 2090 }
2076 return listener->OnMessageReceived(msg); 2091 return listener->OnMessageReceived(msg);
2077 } 2092 }
2078 2093
2079 void RenderProcessHostImpl::OnAssociatedInterfaceRequest( 2094 void RenderProcessHostImpl::OnAssociatedInterfaceRequest(
2080 const std::string& interface_name, 2095 const std::string& interface_name,
2081 mojo::ScopedInterfaceEndpointHandle handle) { 2096 mojo::ScopedInterfaceEndpointHandle handle) {
2082 if (interface_name == mojom::RouteProvider::Name_) { 2097 if (associated_registry_->CanBindRequest(interface_name)) {
2083 if (route_provider_binding_.is_bound()) 2098 associated_registry_->BindRequest(interface_name, std::move(handle));
2084 return;
2085 mojom::RouteProviderAssociatedRequest request;
2086 request.Bind(std::move(handle));
2087 route_provider_binding_.Bind(std::move(request));
2088 } else { 2099 } else {
2089 LOG(ERROR) << "Request for unknown Channel-associated interface: " 2100 LOG(ERROR) << "Request for unknown Channel-associated interface: "
2090 << interface_name; 2101 << interface_name;
2091 } 2102 }
2092 } 2103 }
2093 2104
2094 void RenderProcessHostImpl::OnChannelConnected(int32_t peer_pid) { 2105 void RenderProcessHostImpl::OnChannelConnected(int32_t peer_pid) {
2095 channel_connected_ = true; 2106 channel_connected_ = true;
2096 if (IsReady()) { 2107 if (IsReady()) {
2097 DCHECK(!sent_render_process_ready_); 2108 DCHECK(!sent_render_process_ready_);
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
3085 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 3096 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
3086 3097
3087 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. 3098 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing.
3088 // Capture the error message in a crash key value. 3099 // Capture the error message in a crash key value.
3089 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error); 3100 base::debug::ScopedCrashKey error_key_value("mojo-message-error", error);
3090 bad_message::ReceivedBadMessage(render_process_id, 3101 bad_message::ReceivedBadMessage(render_process_id,
3091 bad_message::RPH_MOJO_PROCESS_ERROR); 3102 bad_message::RPH_MOJO_PROCESS_ERROR);
3092 } 3103 }
3093 3104
3094 } // namespace content 3105 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698