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" |
11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
12 #include "base/hash.h" | 12 #include "base/hash.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
16 #include "base/numerics/safe_math.h" | 16 #include "base/numerics/safe_math.h" |
17 #include "base/path_service.h" | 17 #include "base/path_service.h" |
18 #include "base/process/process_metrics.h" | 18 #include "base/process/process_metrics.h" |
19 #include "base/rand_util.h" | 19 #include "base/rand_util.h" |
20 #include "base/strings/stringprintf.h" | 20 #include "base/strings/stringprintf.h" |
21 #include "base/synchronization/lock.h" | 21 #include "base/synchronization/lock.h" |
22 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 22 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
| 23 #include "base/threading/thread_task_runner_handle.h" |
23 #include "build/build_config.h" | 24 #include "build/build_config.h" |
24 #include "content/common/child_process_messages.h" | 25 #include "content/common/child_process_messages.h" |
25 #include "content/public/common/child_process_host_delegate.h" | 26 #include "content/public/common/child_process_host_delegate.h" |
26 #include "content/public/common/content_paths.h" | 27 #include "content/public/common/content_paths.h" |
27 #include "content/public/common/content_switches.h" | 28 #include "content/public/common/content_switches.h" |
28 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" | 29 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" |
29 #include "ipc/attachment_broker.h" | 30 #include "ipc/attachment_broker.h" |
30 #include "ipc/attachment_broker_privileged.h" | 31 #include "ipc/attachment_broker_privileged.h" |
31 #include "ipc/ipc.mojom.h" | 32 #include "ipc/ipc.mojom.h" |
32 #include "ipc/ipc_channel.h" | 33 #include "ipc/ipc_channel.h" |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string()); | 178 channel_id_ = IPC::Channel::GenerateVerifiedChannelID(std::string()); |
178 channel_ = IPC::Channel::CreateServer(channel_id_, this); | 179 channel_ = IPC::Channel::CreateServer(channel_id_, this); |
179 if (!channel_ || !InitChannel()) | 180 if (!channel_ || !InitChannel()) |
180 return std::string(); | 181 return std::string(); |
181 | 182 |
182 return channel_id_; | 183 return channel_id_; |
183 } | 184 } |
184 | 185 |
185 bool ChildProcessHostImpl::InitChannel() { | 186 bool ChildProcessHostImpl::InitChannel() { |
186 #if USE_ATTACHMENT_BROKER | 187 #if USE_ATTACHMENT_BROKER |
| 188 DCHECK(base::MessageLoopForIO::IsCurrent()); |
187 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( | 189 IPC::AttachmentBroker::GetGlobal()->RegisterCommunicationChannel( |
188 channel_.get(), base::MessageLoopForIO::current()->task_runner()); | 190 channel_.get(), base::ThreadTaskRunnerHandle::Get()); |
189 #endif | 191 #endif |
190 if (!channel_->Connect()) { | 192 if (!channel_->Connect()) { |
191 #if USE_ATTACHMENT_BROKER | 193 #if USE_ATTACHMENT_BROKER |
192 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( | 194 IPC::AttachmentBroker::GetGlobal()->DeregisterCommunicationChannel( |
193 channel_.get()); | 195 channel_.get()); |
194 #endif | 196 #endif |
195 return false; | 197 return false; |
196 } | 198 } |
197 | 199 |
198 for (size_t i = 0; i < filters_.size(); ++i) | 200 for (size_t i = 0; i < filters_.size(); ++i) |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } | 381 } |
380 | 382 |
381 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 383 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
382 gfx::GpuMemoryBufferId id, | 384 gfx::GpuMemoryBufferId id, |
383 const gpu::SyncToken& sync_token) { | 385 const gpu::SyncToken& sync_token) { |
384 // Note: Nothing to do here as ownership of shared memory backed | 386 // Note: Nothing to do here as ownership of shared memory backed |
385 // GpuMemoryBuffers is passed with IPC. | 387 // GpuMemoryBuffers is passed with IPC. |
386 } | 388 } |
387 | 389 |
388 } // namespace content | 390 } // namespace content |
OLD | NEW |