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/atomicops.h" | 9 #include "base/atomicops.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/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
14 #include "base/path_service.h" | 14 #include "base/path_service.h" |
15 #include "base/process/process_metrics.h" | 15 #include "base/process/process_metrics.h" |
16 #include "base/rand_util.h" | 16 #include "base/rand_util.h" |
17 #include "base/strings/stringprintf.h" | 17 #include "base/strings/stringprintf.h" |
18 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" | 18 #include "base/third_party/dynamic_annotations/dynamic_annotations.h" |
19 #include "content/common/child_process_messages.h" | 19 #include "content/common/child_process_messages.h" |
| 20 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
20 #include "content/public/common/child_process_host_delegate.h" | 21 #include "content/public/common/child_process_host_delegate.h" |
21 #include "content/public/common/content_paths.h" | 22 #include "content/public/common/content_paths.h" |
22 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
23 #include "ipc/ipc_channel.h" | 24 #include "ipc/ipc_channel.h" |
24 #include "ipc/ipc_logging.h" | 25 #include "ipc/ipc_logging.h" |
25 | 26 |
26 #if defined(OS_LINUX) | 27 #if defined(OS_LINUX) |
27 #include "base/linux_util.h" | 28 #include "base/linux_util.h" |
28 #elif defined(OS_WIN) | 29 #elif defined(OS_WIN) |
29 #include "content/common/font_cache_dispatcher_win.h" | 30 #include "content/common/font_cache_dispatcher_win.h" |
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 base::SharedMemoryHandle* handle) { | 290 base::SharedMemoryHandle* handle) { |
290 AllocateSharedMemory(buffer_size, peer_handle_, handle); | 291 AllocateSharedMemory(buffer_size, peer_handle_, handle); |
291 } | 292 } |
292 | 293 |
293 void ChildProcessHostImpl::OnShutdownRequest() { | 294 void ChildProcessHostImpl::OnShutdownRequest() { |
294 if (delegate_->CanShutdown()) | 295 if (delegate_->CanShutdown()) |
295 Send(new ChildProcessMsg_Shutdown()); | 296 Send(new ChildProcessMsg_Shutdown()); |
296 } | 297 } |
297 | 298 |
298 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( | 299 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( |
299 uint32 buffer_size, | 300 uint32 width, |
| 301 uint32 height, |
| 302 uint32 internalformat, |
300 gfx::GpuMemoryBufferHandle* handle) { | 303 gfx::GpuMemoryBufferHandle* handle) { |
301 handle->type = gfx::SHARED_MEMORY_BUFFER; | 304 handle->type = gfx::SHARED_MEMORY_BUFFER; |
302 AllocateSharedMemory(buffer_size, peer_handle_, &handle->handle); | 305 AllocateSharedMemory( |
| 306 width * height * GpuMemoryBufferImpl::BytesPerPixel(internalformat), |
| 307 peer_handle_, |
| 308 &handle->handle); |
303 } | 309 } |
304 | 310 |
305 } // namespace content | 311 } // namespace content |
OLD | NEW |