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