| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/child/child_gpu_memory_buffer_manager.h" | 5 #include "content/child/child_gpu_memory_buffer_manager.h" | 
| 6 | 6 | 
| 7 #include <memory> | 7 #include <memory> | 
| 8 #include <utility> | 8 #include <utility> | 
| 9 | 9 | 
| 10 #include "content/common/child_process_messages.h" | 10 #include "content/common/child_process_messages.h" | 
| (...skipping 15 matching lines...) Expand all  Loading... | 
| 26 | 26 | 
| 27 ChildGpuMemoryBufferManager::ChildGpuMemoryBufferManager( | 27 ChildGpuMemoryBufferManager::ChildGpuMemoryBufferManager( | 
| 28     ThreadSafeSender* sender) | 28     ThreadSafeSender* sender) | 
| 29     : sender_(sender) { | 29     : sender_(sender) { | 
| 30 } | 30 } | 
| 31 | 31 | 
| 32 ChildGpuMemoryBufferManager::~ChildGpuMemoryBufferManager() { | 32 ChildGpuMemoryBufferManager::~ChildGpuMemoryBufferManager() { | 
| 33 } | 33 } | 
| 34 | 34 | 
| 35 std::unique_ptr<gfx::GpuMemoryBuffer> | 35 std::unique_ptr<gfx::GpuMemoryBuffer> | 
| 36 ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer( | 36 ChildGpuMemoryBufferManager::CreateGpuMemoryBuffer( | 
| 37     const gfx::Size& size, | 37     const gfx::Size& size, | 
| 38     gfx::BufferFormat format, | 38     gfx::BufferFormat format, | 
| 39     gfx::BufferUsage usage, | 39     gfx::BufferUsage usage, | 
| 40     gpu::SurfaceHandle surface_handle) { | 40     gpu::SurfaceHandle surface_handle) { | 
| 41   DCHECK_EQ(gpu::kNullSurfaceHandle, surface_handle); | 41   DCHECK_EQ(gpu::kNullSurfaceHandle, surface_handle); | 
| 42   TRACE_EVENT2("renderer", | 42   TRACE_EVENT2("renderer", "ChildGpuMemoryBufferManager::CreateGpuMemoryBuffer", | 
| 43                "ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer", | 43                "width", size.width(), "height", size.height()); | 
| 44                "width", |  | 
| 45                size.width(), |  | 
| 46                "height", |  | 
| 47                size.height()); |  | 
| 48 | 44 | 
| 49   gfx::GpuMemoryBufferHandle handle; | 45   gfx::GpuMemoryBufferHandle handle; | 
| 50   IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( | 46   IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( | 
| 51       content::GetNextGenericSharedMemoryId(), size.width(), size.height(), | 47       content::GetNextGenericSharedMemoryId(), size.width(), size.height(), | 
| 52       format, usage, &handle); | 48       format, usage, &handle); | 
| 53   bool success = sender_->Send(message); | 49   bool success = sender_->Send(message); | 
| 54   if (!success || handle.is_null()) | 50   if (!success || handle.is_null()) | 
| 55     return nullptr; | 51     return nullptr; | 
| 56 | 52 | 
| 57   std::unique_ptr<gpu::GpuMemoryBufferImpl> buffer( | 53   std::unique_ptr<gpu::GpuMemoryBufferImpl> buffer( | 
| (...skipping 20 matching lines...) Expand all  Loading... | 
| 78 } | 74 } | 
| 79 | 75 | 
| 80 void ChildGpuMemoryBufferManager::SetDestructionSyncToken( | 76 void ChildGpuMemoryBufferManager::SetDestructionSyncToken( | 
| 81     gfx::GpuMemoryBuffer* buffer, | 77     gfx::GpuMemoryBuffer* buffer, | 
| 82     const gpu::SyncToken& sync_token) { | 78     const gpu::SyncToken& sync_token) { | 
| 83   static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token( | 79   static_cast<gpu::GpuMemoryBufferImpl*>(buffer)->set_destruction_sync_token( | 
| 84       sync_token); | 80       sync_token); | 
| 85 } | 81 } | 
| 86 | 82 | 
| 87 }  // namespace content | 83 }  // namespace content | 
| OLD | NEW | 
|---|