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.h" | 15 #include "base/metrics/histogram.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 "build/build_config.h" | 23 #include "build/build_config.h" |
24 #include "content/common/child_process_messages.h" | 24 #include "content/common/child_process_messages.h" |
25 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" | |
26 #include "content/public/common/child_process_host_delegate.h" | 25 #include "content/public/common/child_process_host_delegate.h" |
27 #include "content/public/common/content_paths.h" | 26 #include "content/public/common/content_paths.h" |
28 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
| 28 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" |
29 #include "ipc/attachment_broker.h" | 29 #include "ipc/attachment_broker.h" |
30 #include "ipc/attachment_broker_privileged.h" | 30 #include "ipc/attachment_broker_privileged.h" |
31 #include "ipc/ipc_channel.h" | 31 #include "ipc/ipc_channel.h" |
32 #include "ipc/ipc_logging.h" | 32 #include "ipc/ipc_logging.h" |
33 #include "ipc/message_filter.h" | 33 #include "ipc/message_filter.h" |
34 | 34 |
35 #if defined(OS_LINUX) | 35 #if defined(OS_LINUX) |
36 #include "base/linux_util.h" | 36 #include "base/linux_util.h" |
37 #elif defined(OS_WIN) | 37 #elif defined(OS_WIN) |
38 #include "content/common/font_cache_dispatcher_win.h" | 38 #include "content/common/font_cache_dispatcher_win.h" |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 uint32_t width, | 310 uint32_t width, |
311 uint32_t height, | 311 uint32_t height, |
312 gfx::BufferFormat format, | 312 gfx::BufferFormat format, |
313 gfx::BufferUsage usage, | 313 gfx::BufferUsage usage, |
314 gfx::GpuMemoryBufferHandle* handle) { | 314 gfx::GpuMemoryBufferHandle* handle) { |
315 // TODO(reveman): Add support for other types of GpuMemoryBuffers. | 315 // TODO(reveman): Add support for other types of GpuMemoryBuffers. |
316 | 316 |
317 // AllocateForChildProcess() will check if |width| and |height| are valid | 317 // AllocateForChildProcess() will check if |width| and |height| are valid |
318 // and handle failure in a controlled way when not. We just need to make | 318 // and handle failure in a controlled way when not. We just need to make |
319 // sure |usage| is supported here. | 319 // sure |usage| is supported here. |
320 if (GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) { | 320 if (gpu::GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) { |
321 *handle = GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( | 321 *handle = gpu::GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( |
322 id, gfx::Size(width, height), format, peer_process_.Handle()); | 322 id, gfx::Size(width, height), format, peer_process_.Handle()); |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 326 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
327 gfx::GpuMemoryBufferId id, | 327 gfx::GpuMemoryBufferId id, |
328 const gpu::SyncToken& sync_token) { | 328 const gpu::SyncToken& sync_token) { |
329 // Note: Nothing to do here as ownership of shared memory backed | 329 // Note: Nothing to do here as ownership of shared memory backed |
330 // GpuMemoryBuffers is passed with IPC. | 330 // GpuMemoryBuffers is passed with IPC. |
331 } | 331 } |
332 | 332 |
333 } // namespace content | 333 } // namespace content |
OLD | NEW |