| 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 } | 347 } |
| 348 | 348 |
| 349 void ChildProcessHostImpl::OnShutdownRequest() { | 349 void ChildProcessHostImpl::OnShutdownRequest() { |
| 350 if (delegate_->CanShutdown()) | 350 if (delegate_->CanShutdown()) |
| 351 Send(new ChildProcessMsg_Shutdown()); | 351 Send(new ChildProcessMsg_Shutdown()); |
| 352 } | 352 } |
| 353 | 353 |
| 354 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( | 354 void ChildProcessHostImpl::OnAllocateGpuMemoryBuffer( |
| 355 uint32 width, | 355 uint32 width, |
| 356 uint32 height, | 356 uint32 height, |
| 357 gfx::GpuMemoryBuffer::Format format, | 357 gfx::BufferFormat format, |
| 358 gfx::GpuMemoryBuffer::Usage usage, | 358 gfx::BufferUsage usage, |
| 359 gfx::GpuMemoryBufferHandle* handle) { | 359 gfx::GpuMemoryBufferHandle* handle) { |
| 360 // TODO(reveman): Add support for other types of GpuMemoryBuffers. | 360 // TODO(reveman): Add support for other types of GpuMemoryBuffers. |
| 361 | 361 |
| 362 // AllocateForChildProcess() will check if |width| and |height| are valid | 362 // AllocateForChildProcess() will check if |width| and |height| are valid |
| 363 // and handle failure in a controlled way when not. We just need to make | 363 // and handle failure in a controlled way when not. We just need to make |
| 364 // sure |format| and |usage| are supported here. | 364 // sure |format| and |usage| are supported here. |
| 365 if (GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) && | 365 if (GpuMemoryBufferImplSharedMemory::IsFormatSupported(format) && |
| 366 GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) { | 366 GpuMemoryBufferImplSharedMemory::IsUsageSupported(usage)) { |
| 367 *handle = GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( | 367 *handle = GpuMemoryBufferImplSharedMemory::AllocateForChildProcess( |
| 368 g_next_gpu_memory_buffer_id.GetNext(), gfx::Size(width, height), format, | 368 g_next_gpu_memory_buffer_id.GetNext(), gfx::Size(width, height), format, |
| 369 peer_process_.Handle()); | 369 peer_process_.Handle()); |
| 370 } | 370 } |
| 371 } | 371 } |
| 372 | 372 |
| 373 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( | 373 void ChildProcessHostImpl::OnDeletedGpuMemoryBuffer( |
| 374 gfx::GpuMemoryBufferId id, | 374 gfx::GpuMemoryBufferId id, |
| 375 uint32 sync_point) { | 375 uint32 sync_point) { |
| 376 // Note: Nothing to do here as ownership of shared memory backed | 376 // Note: Nothing to do here as ownership of shared memory backed |
| 377 // GpuMemoryBuffers is passed with IPC. | 377 // GpuMemoryBuffers is passed with IPC. |
| 378 } | 378 } |
| 379 | 379 |
| 380 } // namespace content | 380 } // namespace content |
| OLD | NEW |