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 ChildNativePixmapManager::CreateSingleton(sender_.get()); |
| 49 #endif |
| 50 |
43 gfx::GpuMemoryBufferHandle handle; | 51 gfx::GpuMemoryBufferHandle handle; |
44 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( | 52 IPC::Message* message = new ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer( |
45 size.width(), size.height(), format, usage, &handle); | 53 size.width(), size.height(), format, usage, &handle); |
46 bool success = sender_->Send(message); | 54 bool success = sender_->Send(message); |
47 if (!success || handle.is_null()) | 55 if (!success || handle.is_null()) |
48 return nullptr; | 56 return nullptr; |
49 | 57 |
50 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( | 58 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( |
51 handle, size, format, usage, | 59 handle, size, format, usage, |
52 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.id))); | 60 base::Bind(&DeletedGpuMemoryBuffer, sender_, handle.id))); |
(...skipping 12 matching lines...) Expand all Loading... |
65 } | 73 } |
66 | 74 |
67 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint( | 75 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint( |
68 gfx::GpuMemoryBuffer* buffer, | 76 gfx::GpuMemoryBuffer* buffer, |
69 uint32 sync_point) { | 77 uint32 sync_point) { |
70 static_cast<GpuMemoryBufferImpl*>(buffer) | 78 static_cast<GpuMemoryBufferImpl*>(buffer) |
71 ->set_destruction_sync_point(sync_point); | 79 ->set_destruction_sync_point(sync_point); |
72 } | 80 } |
73 | 81 |
74 } // namespace content | 82 } // namespace content |
OLD | NEW |