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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 filter->OnFilterAdded(channel_.get()); | 126 filter->OnFilterAdded(channel_.get()); |
127 } | 127 } |
128 | 128 |
129 void ChildProcessHostImpl::ForceShutdown() { | 129 void ChildProcessHostImpl::ForceShutdown() { |
130 Send(new ChildProcessMsg_Shutdown()); | 130 Send(new ChildProcessMsg_Shutdown()); |
131 } | 131 } |
132 | 132 |
133 std::string ChildProcessHostImpl::CreateChannel() { | 133 std::string ChildProcessHostImpl::CreateChannel() { |
134 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string()); | 134 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string()); |
135 channel_ = IPC::Channel::CreateServer(channel_id_, this); | 135 channel_ = IPC::Channel::CreateServer(channel_id_, this); |
136 if (!channel_->Connect()) | |
137 return std::string(); | |
138 #if USE_ATTACHMENT_BROKER | 136 #if USE_ATTACHMENT_BROKER |
139 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 137 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( |
140 channel_.get(), base::MessageLoopForIO::current()->task_runner()); | 138 channel_.get(), base::MessageLoopForIO::current()->task_runner()); |
141 #endif | 139 #endif |
| 140 if (!channel_->Connect()) { |
| 141 #if USE_ATTACHMENT_BROKER |
| 142 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( |
| 143 channel_.get()); |
| 144 #endif |
| 145 return std::string(); |
| 146 } |
142 | 147 |
143 for (size_t i = 0; i < filters_.size(); ++i) | 148 for (size_t i = 0; i < filters_.size(); ++i) |
144 filters_[i]->OnFilterAdded(channel_.get()); | 149 filters_[i]->OnFilterAdded(channel_.get()); |
145 | 150 |
146 // Make sure these messages get sent first. | 151 // Make sure these messages get sent first. |
147 #if defined(IPC_MESSAGE_LOG_ENABLED) | 152 #if defined(IPC_MESSAGE_LOG_ENABLED) |
148 bool enabled = IPC::Logging::GetInstance()->Enabled(); | 153 bool enabled = IPC::Logging::GetInstance()->Enabled(); |
149 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled)); | 154 Send(new ChildProcessMsg_SetIPCLoggingEnabled(enabled)); |
150 #endif | 155 #endif |
151 | 156 |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 } | 329 } |
325 | 330 |
326 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 331 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
327 gfx::GpuMemoryBufferId id, | 332 gfx::GpuMemoryBufferId id, |
328 const gpu::SyncToken& sync_token) { | 333 const gpu::SyncToken& sync_token) { |
329 // Note: Nothing to do here as ownership of shared memory backed | 334 // Note: Nothing to do here as ownership of shared memory backed |
330 // GpuMemoryBuffers is passed with IPC. | 335 // GpuMemoryBuffers is passed with IPC. |
331 } | 336 } |
332 | 337 |
333 } // namespace content | 338 } // namespace content |
OLD | NEW |