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