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 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
854 void RenderProcessHostImpl::EnableSendQueue() { | 854 void RenderProcessHostImpl::EnableSendQueue() { |
855 is_initialized_ = false; | 855 is_initialized_ = false; |
856 } | 856 } |
857 | 857 |
858 bool RenderProcessHostImpl::Init() { | 858 bool RenderProcessHostImpl::Init() { |
859 // calling Init() more than once does nothing, this makes it more convenient | 859 // calling Init() more than once does nothing, this makes it more convenient |
860 // for the view host which may not be sure in some cases | 860 // for the view host which may not be sure in some cases |
861 if (channel_) | 861 if (channel_) |
862 return true; | 862 return true; |
863 | 863 |
864 // Ensure that the RouteProvider proxy is re-initialized on next access since | 864 // Ensure that the remote associated interfaces are re-initialized on next |
865 // it's associated with a specific Channel instance. | 865 // access since they're associated with a specific Channel instance. |
866 remote_route_provider_.reset(); | 866 remote_route_provider_.reset(); |
| 867 renderer_interface_.reset(); |
867 | 868 |
868 base::CommandLine::StringType renderer_prefix; | 869 base::CommandLine::StringType renderer_prefix; |
869 // A command prefix is something prepended to the command line of the spawned | 870 // A command prefix is something prepended to the command line of the spawned |
870 // process. | 871 // process. |
871 const base::CommandLine& browser_command_line = | 872 const base::CommandLine& browser_command_line = |
872 *base::CommandLine::ForCurrentProcess(); | 873 *base::CommandLine::ForCurrentProcess(); |
873 renderer_prefix = | 874 renderer_prefix = |
874 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); | 875 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
875 | 876 |
876 #if defined(OS_LINUX) | 877 #if defined(OS_LINUX) |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1412 } | 1413 } |
1413 | 1414 |
1414 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { | 1415 mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { |
1415 if (!remote_route_provider_) { | 1416 if (!remote_route_provider_) { |
1416 DCHECK(channel_); | 1417 DCHECK(channel_); |
1417 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); | 1418 channel_->GetRemoteAssociatedInterface(&remote_route_provider_); |
1418 } | 1419 } |
1419 return remote_route_provider_.get(); | 1420 return remote_route_provider_.get(); |
1420 } | 1421 } |
1421 | 1422 |
| 1423 mojom::Renderer* RenderProcessHostImpl::GetRendererInterface() { |
| 1424 if (!renderer_interface_) { |
| 1425 DCHECK(channel_); |
| 1426 channel_->GetRemoteAssociatedInterface(&renderer_interface_); |
| 1427 } |
| 1428 return renderer_interface_.get(); |
| 1429 } |
| 1430 |
1422 void RenderProcessHostImpl::AddRoute(int32_t routing_id, | 1431 void RenderProcessHostImpl::AddRoute(int32_t routing_id, |
1423 IPC::Listener* listener) { | 1432 IPC::Listener* listener) { |
1424 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " | 1433 CHECK(!listeners_.Lookup(routing_id)) << "Found Routing ID Conflict: " |
1425 << routing_id; | 1434 << routing_id; |
1426 listeners_.AddWithID(listener, routing_id); | 1435 listeners_.AddWithID(listener, routing_id); |
1427 } | 1436 } |
1428 | 1437 |
1429 void RenderProcessHostImpl::RemoveRoute(int32_t routing_id) { | 1438 void RenderProcessHostImpl::RemoveRoute(int32_t routing_id) { |
1430 DCHECK(listeners_.Lookup(routing_id) != nullptr); | 1439 DCHECK(listeners_.Lookup(routing_id) != nullptr); |
1431 listeners_.Remove(routing_id); | 1440 listeners_.Remove(routing_id); |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3015 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; | 3024 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; |
3016 | 3025 |
3017 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias | 3026 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias |
3018 // enough information here so that we can determine what the bad message was. | 3027 // enough information here so that we can determine what the bad message was. |
3019 base::debug::Alias(&error); | 3028 base::debug::Alias(&error); |
3020 bad_message::ReceivedBadMessage(process.get(), | 3029 bad_message::ReceivedBadMessage(process.get(), |
3021 bad_message::RPH_MOJO_PROCESS_ERROR); | 3030 bad_message::RPH_MOJO_PROCESS_ERROR); |
3022 } | 3031 } |
3023 | 3032 |
3024 } // namespace content | 3033 } // namespace content |
OLD | NEW |