| 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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 IPC::mojom::ChannelBootstrapPtr bootstrap; | 166 IPC::mojom::ChannelBootstrapPtr bootstrap; |
| 167 remote_interfaces->GetInterface(&bootstrap); | 167 remote_interfaces->GetInterface(&bootstrap); |
| 168 channel_ = IPC::ChannelMojo::Create(bootstrap.PassInterface().PassHandle(), | 168 channel_ = IPC::ChannelMojo::Create(bootstrap.PassInterface().PassHandle(), |
| 169 IPC::Channel::MODE_SERVER, this); | 169 IPC::Channel::MODE_SERVER, this); |
| 170 DCHECK(channel_); | 170 DCHECK(channel_); |
| 171 | 171 |
| 172 bool initialized = InitChannel(); | 172 bool initialized = InitChannel(); |
| 173 DCHECK(initialized); | 173 DCHECK(initialized); |
| 174 } | 174 } |
| 175 | 175 |
| 176 std::string ChildProcessHostImpl::CreateChannel() { | |
| 177 DCHECK(channel_id_.empty()); | |
| 178 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string()); | |
| 179 channel_ = IPC::Channel::CreateServer(channel_id_, this); | |
| 180 if (!channel_ || !InitChannel()) | |
| 181 return std::string(); | |
| 182 | |
| 183 return channel_id_; | |
| 184 } | |
| 185 | |
| 186 bool ChildProcessHostImpl::InitChannel() { | 176 bool ChildProcessHostImpl::InitChannel() { |
| 187 #if USE_ATTACHMENT_BROKER | 177 #if USE_ATTACHMENT_BROKER |
| 188 DCHECK(base::MessageLoopForIO::IsCurrent()); | 178 DCHECK(base::MessageLoopForIO::IsCurrent()); |
| 189 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 179 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( |
| 190 channel_.get(), base::ThreadTaskRunnerHandle::Get()); | 180 channel_.get(), base::ThreadTaskRunnerHandle::Get()); |
| 191 #endif | 181 #endif |
| 192 if (!channel_->Connect()) { | 182 if (!channel_->Connect()) { |
| 193 #if USE_ATTACHMENT_BROKER | 183 #if USE_ATTACHMENT_BROKER |
| 194 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( | 184 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( |
| 195 channel_.get()); | 185 channel_.get()); |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 } | 371 } |
| 382 | 372 |
| 383 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 373 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
| 384 gfx::GpuMemoryBufferId id, | 374 gfx::GpuMemoryBufferId id, |
| 385 const gpu::SyncToken& sync_token) { | 375 const gpu::SyncToken& sync_token) { |
| 386 // Note: Nothing to do here as ownership of shared memory backed | 376 // Note: Nothing to do here as ownership of shared memory backed |
| 387 // GpuMemoryBuffers is passed with IPC. | 377 // GpuMemoryBuffers is passed with IPC. |
| 388 } | 378 } |
| 389 | 379 |
| 390 } // namespace content | 380 } // namespace content |
| OLD | NEW |