OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "content/common/child_process_host_impl.h" | 5 #include "content/common/child_process_host_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 service_manager::InterfaceProvider* | 114 service_manager::InterfaceProvider* |
115 ChildProcessHostImpl::GetRemoteInterfaces() { | 115 ChildProcessHostImpl::GetRemoteInterfaces() { |
116 return delegate_->GetRemoteInterfaces(); | 116 return delegate_->GetRemoteInterfaces(); |
117 } | 117 } |
118 | 118 |
119 void ChildProcessHostImpl::ForceShutdown() { | 119 void ChildProcessHostImpl::ForceShutdown() { |
120 Send(new ChildProcessMsg_Shutdown()); | 120 Send(new ChildProcessMsg_Shutdown()); |
121 } | 121 } |
122 | 122 |
123 std::string ChildProcessHostImpl::CreateChannelMojo( | 123 std::string ChildProcessHostImpl::CreateChannelMojo( |
124 const std::string& child_token) { | 124 mojo::edk::PendingProcessConnection* connection) { |
125 DCHECK(channel_id_.empty()); | 125 DCHECK(channel_id_.empty()); |
126 channel_id_ = mojo::edk::GenerateRandomToken(); | 126 channel_ = |
127 mojo::ScopedMessagePipeHandle host_handle = | 127 IPC::ChannelMojo::Create(connection->CreateMessagePipe(&channel_id_), |
128 mojo::edk::CreateParentMessagePipe(channel_id_, child_token); | 128 IPC::Channel::MODE_SERVER, this); |
129 channel_ = IPC::ChannelMojo::Create(std::move(host_handle), | |
130 IPC::Channel::MODE_SERVER, this); | |
131 if (!channel_ || !InitChannel()) | 129 if (!channel_ || !InitChannel()) |
132 return std::string(); | 130 return std::string(); |
133 | |
134 return channel_id_; | 131 return channel_id_; |
135 } | 132 } |
136 | 133 |
137 void ChildProcessHostImpl::CreateChannelMojo() { | 134 void ChildProcessHostImpl::CreateChannelMojo() { |
138 // TODO(rockot): Remove |channel_id_| once this is the only code path by which | 135 // TODO(rockot): Remove |channel_id_| once this is the only code path by which |
139 // the Channel is created. For now it serves to at least mutually exclude | 136 // the Channel is created. For now it serves to at least mutually exclude |
140 // different CreateChannel* calls. | 137 // different CreateChannel* calls. |
141 DCHECK(channel_id_.empty()); | 138 DCHECK(channel_id_.empty()); |
142 channel_id_ = "ChannelMojo"; | 139 channel_id_ = "ChannelMojo"; |
143 | 140 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) { | 281 void ChildProcessHostImpl::OnBadMessageReceived(const IPC::Message& message) { |
285 delegate_->OnBadMessageReceived(message); | 282 delegate_->OnBadMessageReceived(message); |
286 } | 283 } |
287 | 284 |
288 void ChildProcessHostImpl::OnShutdownRequest() { | 285 void ChildProcessHostImpl::OnShutdownRequest() { |
289 if (delegate_->CanShutdown()) | 286 if (delegate_->CanShutdown()) |
290 Send(new ChildProcessMsg_Shutdown()); | 287 Send(new ChildProcessMsg_Shutdown()); |
291 } | 288 } |
292 | 289 |
293 } // namespace content | 290 } // namespace content |
OLD | NEW |