OLD | NEW |
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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 void RenderProcessHostImpl::EnableSendQueue() { | 860 void RenderProcessHostImpl::EnableSendQueue() { |
861 is_initialized_ = false; | 861 is_initialized_ = false; |
862 } | 862 } |
863 | 863 |
864 bool RenderProcessHostImpl::Init() { | 864 bool RenderProcessHostImpl::Init() { |
865 // calling Init() more than once does nothing, this makes it more convenient | 865 // calling Init() more than once does nothing, this makes it more convenient |
866 // for the view host which may not be sure in some cases | 866 // for the view host which may not be sure in some cases |
867 if (channel_) | 867 if (channel_) |
868 return true; | 868 return true; |
869 | 869 |
870 // Ensure that the RouteProvider proxy is re-initialized on next access since | 870 // Ensure that the remote associated interfaces are re-initialized on next |
871 // it's associated with a specific Channel instance. | 871 // access since they're associated with a specific Channel instance. |
872 remote_route_provider_.reset(); | 872 remote_route_provider_.reset(); |
| 873 renderer_interface_.reset(); |
873 | 874 |
874 base::CommandLine::StringType renderer_prefix; | 875 base::CommandLine::StringType renderer_prefix; |
875 // A command prefix is something prepended to the command line of the spawned | 876 // A command prefix is something prepended to the command line of the spawned |
876 // process. | 877 // process. |
877 const base::CommandLine& browser_command_line = | 878 const base::CommandLine& browser_command_line = |
878 *base::CommandLine::ForCurrentProcess(); | 879 *base::CommandLine::ForCurrentProcess(); |
879 renderer_prefix = | 880 renderer_prefix = |
880 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); | 881 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
881 | 882 |
882 #if defined(OS_LINUX) | 883 #if defined(OS_LINUX) |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 } | 1443 } |
1443 | 1444 |
1444 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { | 1445 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { |
1445 if (!remote_route_provider_) { | 1446 if (!remote_route_provider_) { |
1446 DCHECK(channel_); | 1447 DCHECK(channel_); |
1447 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); | 1448 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); |
1448 } | 1449 } |
1449 return remote_route_provider_.get(); | 1450 return remote_route_provider_.get(); |
1450 } | 1451 } |
1451 | 1452 |
| 1453 mojom::Renderer* RenderProcessHostImpl::GetRendererInterface() { |
| 1454 if (!renderer_interface_) { |
| 1455 DCHECK(channel_); |
| 1456 channel_->GetRemoteAssociatedInterface(&renderer_interface_); |
| 1457 } |
| 1458 return renderer_interface_.get(); |
| 1459 } |
| 1460 |
1452 void RenderProcessHostImpl::AddRoute(int32_t routing_id, | 1461 void RenderProcessHostImpl::AddRoute(int32_t routing_id, |
1453 IPC::Listener* listener) { | 1462 IPC::Listener* listener) { |
1454 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " | 1463 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " |
1455 << routing_id; | 1464 << routing_id; |
1456 listeners_.AddWithID(listener, routing_id); | 1465 listeners_.AddWithID(listener, routing_id); |
1457 } | 1466 } |
1458 | 1467 |
1459 void RenderProcessHostImpl::RemoveRoute(int32_t routing_id) { | 1468 void RenderProcessHostImpl::RemoveRoute(int32_t routing_id) { |
1460 DCHECK(listeners_.Lookup(routing_id) != nullptr); | 1469 DCHECK(listeners_.Lookup(routing_id) != nullptr); |
1461 listeners_.Remove(routing_id); | 1470 listeners_.Remove(routing_id); |
(...skipping 1584 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3046 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3055 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
3047 | 3056 |
3048 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 3057 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
3049 // enough information here so that we can determine what the bad message was. | 3058 // enough information here so that we can determine what the bad message was. |
3050 base::debug::Alias(&error); | 3059 base::debug::Alias(&error); |
3051 bad_message::ReceivedBadMessage(process.get(), | 3060 bad_message::ReceivedBadMessage(process.get(), |
3052 bad_message::RPH_MOJO_PROCESS_ERROR); | 3061 bad_message::RPH_MOJO_PROCESS_ERROR); |
3053 } | 3062 } |
3054 | 3063 |
3055 } // namespace content | 3064 } // namespace content |
OLD | NEW |