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 "ui/ozone/public/native_pixmap_client.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 ui::NativePixmapClient::InitializeIfNeeded(); | |
dshwang
2015/06/03 14:11:51
As you mentioned "The processes that want one will
spang
2015/06/05 19:21:53
Lazy initialization leads to unpredictable initial
reveman
2015/06/05 20:26:06
The MacOSX equivalent to NativePixmap is IOSurface
dshwang
2015/06/08 11:15:14
Done. Initialize it in render_thread_impl.cc, not
| |
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) | 55 if (!success) |
48 return scoped_ptr<gfx::GpuMemoryBuffer>(); | 56 return scoped_ptr<gfx::GpuMemoryBuffer>(); |
49 | 57 |
50 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( | 58 scoped_ptr<GpuMemoryBufferImpl> buffer(GpuMemoryBufferImpl::CreateFromHandle( |
51 handle, | 59 handle, |
52 size, | 60 size, |
(...skipping 14 matching lines...) Expand all Loading... | |
67 } | 75 } |
68 | 76 |
69 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint( | 77 void ChildGpuMemoryBufferManager::SetDestructionSyncPoint( |
70 gfx::GpuMemoryBuffer* buffer, | 78 gfx::GpuMemoryBuffer* buffer, |
71 uint32 sync_point) { | 79 uint32 sync_point) { |
72 static_cast<GpuMemoryBufferImpl*>(buffer) | 80 static_cast<GpuMemoryBufferImpl*>(buffer) |
73 ->set_destruction_sync_point(sync_point); | 81 ->set_destruction_sync_point(sync_point); |
74 } | 82 } |
75 | 83 |
76 } // namespace content | 84 } // namespace content |
OLD | NEW |