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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) { | 127 void ChildProcessHostImpl::AddFilter(IPC::MessageFilter* filter) { |
128 filters_.push_back(filter); | 128 filters_.push_back(filter); |
129 | 129 |
130 if (channel_) | 130 if (channel_) |
131 filter->OnFilterAdded(channel_.get()); | 131 filter->OnFilterAdded(channel_.get()); |
132 } | 132 } |
133 | 133 |
134 shell::InterfaceProvider* ChildProcessHostImpl::GetRemoteInterfaces() { | 134 service_manager::InterfaceProvider* |
| 135 ChildProcessHostImpl::GetRemoteInterfaces() { |
135 return delegate_->GetRemoteInterfaces(); | 136 return delegate_->GetRemoteInterfaces(); |
136 } | 137 } |
137 | 138 |
138 void ChildProcessHostImpl::ForceShutdown() { | 139 void ChildProcessHostImpl::ForceShutdown() { |
139 Send(new ChildProcessMsg_Shutdown()); | 140 Send(new ChildProcessMsg_Shutdown()); |
140 } | 141 } |
141 | 142 |
142 std::string ChildProcessHostImpl::CreateChannelMojo( | 143 std::string ChildProcessHostImpl::CreateChannelMojo( |
143 const std::string& child_token) { | 144 const std::string& child_token) { |
144 DCHECK(channel_id_.empty()); | 145 DCHECK(channel_id_.empty()); |
145 channel_id_ = mojo::edk::GenerateRandomToken(); | 146 channel_id_ = mojo::edk::GenerateRandomToken(); |
146 mojo::ScopedMessagePipeHandle host_handle = | 147 mojo::ScopedMessagePipeHandle host_handle = |
147 mojo::edk::CreateParentMessagePipe(channel_id_, child_token); | 148 mojo::edk::CreateParentMessagePipe(channel_id_, child_token); |
148 channel_ = IPC::ChannelMojo::Create(std::move(host_handle), | 149 channel_ = IPC::ChannelMojo::Create(std::move(host_handle), |
149 IPC::Channel::MODE_SERVER, this); | 150 IPC::Channel::MODE_SERVER, this); |
150 if (!channel_ || !InitChannel()) | 151 if (!channel_ || !InitChannel()) |
151 return std::string(); | 152 return std::string(); |
152 | 153 |
153 return channel_id_; | 154 return channel_id_; |
154 } | 155 } |
155 | 156 |
156 void ChildProcessHostImpl::CreateChannelMojo() { | 157 void ChildProcessHostImpl::CreateChannelMojo() { |
157 // TODO(rockot): Remove |channel_id_| once this is the only code path by which | 158 // TODO(rockot): Remove |channel_id_| once this is the only code path by which |
158 // the Channel is created. For now it serves to at least mutually exclude | 159 // the Channel is created. For now it serves to at least mutually exclude |
159 // different CreateChannel* calls. | 160 // different CreateChannel* calls. |
160 DCHECK(channel_id_.empty()); | 161 DCHECK(channel_id_.empty()); |
161 channel_id_ = "ChannelMojo"; | 162 channel_id_ = "ChannelMojo"; |
162 | 163 |
163 shell::InterfaceProvider* remote_interfaces = GetRemoteInterfaces(); | 164 service_manager::InterfaceProvider* remote_interfaces = GetRemoteInterfaces(); |
164 DCHECK(remote_interfaces); | 165 DCHECK(remote_interfaces); |
165 | 166 |
166 IPC::mojom::ChannelBootstrapPtr bootstrap; | 167 IPC::mojom::ChannelBootstrapPtr bootstrap; |
167 remote_interfaces->GetInterface(&bootstrap); | 168 remote_interfaces->GetInterface(&bootstrap); |
168 channel_ = IPC::ChannelMojo::Create(bootstrap.PassInterface().PassHandle(), | 169 channel_ = IPC::ChannelMojo::Create(bootstrap.PassInterface().PassHandle(), |
169 IPC::Channel::MODE_SERVER, this); | 170 IPC::Channel::MODE_SERVER, this); |
170 DCHECK(channel_); | 171 DCHECK(channel_); |
171 | 172 |
172 bool initialized = InitChannel(); | 173 bool initialized = InitChannel(); |
173 DCHECK(initialized); | 174 DCHECK(initialized); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 372 } |
372 | 373 |
373 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 374 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
374 gfx::GpuMemoryBufferId id, | 375 gfx::GpuMemoryBufferId id, |
375 const gpu::SyncToken& sync_token) { | 376 const gpu::SyncToken& sync_token) { |
376 // Note: Nothing to do here as ownership of shared memory backed | 377 // Note: Nothing to do here as ownership of shared memory backed |
377 // GpuMemoryBuffers is passed with IPC. | 378 // GpuMemoryBuffers is passed with IPC. |
378 } | 379 } |
379 | 380 |
380 } // namespace content | 381 } // namespace content |
OLD | NEW |