Chromium Code Reviews| 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 "content/common/child_process_messages.h" | 7 #include "content/common/child_process_messages.h" |
| 8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
| 9 | 9 |
| 10 #if defined(USE_OZONE) | |
| 11 #include "content/child/child_native_pixmap_manager_ozone.h" | |
| 12 #endif | |
| 13 | |
| 10 namespace content { | 14 namespace content { |
| 11 namespace { | 15 namespace { |
| 12 | 16 |
| 13 void DeletedGpuMemoryBuffer(ThreadSafeSender* sender, | 17 void DeletedGpuMemoryBuffer(ThreadSafeSender* sender, |
| 14 gfx::GpuMemoryBufferId id, | 18 gfx::GpuMemoryBufferId id, |
| 15 uint32 sync_point) { | 19 uint32 sync_point) { |
| 16 TRACE_EVENT0("renderer", | 20 TRACE_EVENT0("renderer", |
| 17 "ChildGpuMemoryBufferManager::DeletedGpuMemoryBuffer"); | 21 "ChildGpuMemoryBufferManager::DeletedGpuMemoryBuffer"); |
| 18 sender->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(id, sync_point)); | 22 sender->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(id, sync_point)); |
| 19 } | 23 } |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 33 const gfx::Size& size, | 37 const gfx::Size& size, |
| 34 gfx::GpuMemoryBuffer::Format format, | 38 gfx::GpuMemoryBuffer::Format format, |
| 35 gfx::GpuMemoryBuffer::Usage usage) { | 39 gfx::GpuMemoryBuffer::Usage usage) { |
| 36 TRACE_EVENT2("renderer", | 40 TRACE_EVENT2("renderer", |
| 37 "ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer", | 41 "ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer", |
| 38 "width", | 42 "width", |
| 39 size.width(), | 43 size.width(), |
| 40 "height", | 44 "height", |
| 41 size.height()); | 45 size.height()); |
| 42 | 46 |
| 47 #if defined(USE_OZONE) | |
| 48 if (!ui::NativePixmapManager::GetInstance()) { | |
| 49 ui::NativePixmapManager::SetInstance( | |
| 50 ChildNativePixmapManager::CreateSingleton(sender_.get())); | |
|
dshwang
2015/07/06 18:45:01
Make the singleton ChildNativePixmapManager here w
| |
| 51 } | |
| 52 #endif | |
| 53 | |
| 43 gfx::GpuMemoryBufferHandle handle; | 54 gfx::GpuMemoryBufferHandle handle; |
| 44 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( | 55 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( |
| 45 size.width(), size.height(), format, usage, &handle); | 56 size.width(), size.height(), format, usage, &handle); |
| 46 bool success = sender_->Send(message); | 57 bool success = sender_->Send(message); |
| 47 if (!success || handle.is_null()) | 58 if (!success || handle.is_null()) |
| 48 return nullptr; | 59 return nullptr; |
| 49 | 60 |
| 50 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( | 61 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( |
| 51 handle, size, format, usage, | 62 handle, size, format, usage, |
| 52 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.id))); | 63 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.id))); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 65 } | 76 } |
| 66 | 77 |
| 67 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint( | 78 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint( |
| 68 gfx::GpuMemoryBuffer* buffer, | 79 gfx::GpuMemoryBuffer* buffer, |
| 69 uint32 sync_point) { | 80 uint32 sync_point) { |
| 70 static_cast<GpuMemoryBufferImpl*>(buffer) | 81 static_cast<GpuMemoryBufferImpl*>(buffer) |
| 71 ->set_destruction_sync_point(sync_point); | 82 ->set_destruction_sync_point(sync_point); |
| 72 } | 83 } |
| 73 | 84 |
| 74 } // namespace content | 85 } // namespace content |
| OLD | NEW |