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/common/gpu/gpu_memory_buffer_factory_ozone_native_buffer.h" | 5 #include "content/common/gpu/gpu_memory_buffer_factory_ozone_native_buffer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/gl/gl_image.h" | 8 #include "ui/gl/gl_image.h" |
9 #include "ui/ozone/public/native_pixmap_manager.h" | 9 #include "ui/ozone/public/native_pixmap_manager.h" |
10 | 10 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 | 93 |
94 gfx::GpuMemoryBufferHandle | 94 gfx::GpuMemoryBufferHandle |
95 GpuMemoryBufferFactoryOzoneNativeBuffer::CreateGpuMemoryBuffer( | 95 GpuMemoryBufferFactoryOzoneNativeBuffer::CreateGpuMemoryBuffer( |
96 gfx::GpuMemoryBufferId id, | 96 gfx::GpuMemoryBufferId id, |
97 const gfx::Size& size, | 97 const gfx::Size& size, |
98 gfx::GpuMemoryBuffer::Format format, | 98 gfx::GpuMemoryBuffer::Format format, |
99 gfx::GpuMemoryBuffer::Usage usage, | 99 gfx::GpuMemoryBuffer::Usage usage, |
100 int client_id, | 100 int client_id, |
101 gfx::PluginWindowHandle surface_handle) { | 101 gfx::PluginWindowHandle surface_handle) { |
102 if (!ozone_native_buffer_factory_.CreateGpuMemoryBuffer( | 102 return ozone_native_buffer_factory_.CreateGpuMemoryBuffer( |
103 id, size, format, usage, client_id, surface_handle)) { | 103 id, size, format, usage, client_id, surface_handle); |
104 return gfx::GpuMemoryBufferHandle(); | |
105 } | |
106 gfx::GpuMemoryBufferHandle handle; | |
107 handle.type = gfx::OZONE_NATIVE_BUFFER; | |
108 handle.id = id; | |
109 return handle; | |
110 } | 104 } |
111 | 105 |
112 void GpuMemoryBufferFactoryOzoneNativeBuffer::DestroyGpuMemoryBuffer( | 106 void GpuMemoryBufferFactoryOzoneNativeBuffer::DestroyGpuMemoryBuffer( |
113 gfx::GpuMemoryBufferId id, | 107 gfx::GpuMemoryBufferId id, |
114 int client_id) { | 108 int client_id) { |
115 ozone_native_buffer_factory_.DestroyGpuMemoryBuffer(id, client_id); | 109 ozone_native_buffer_factory_.DestroyGpuMemoryBuffer(id, client_id); |
116 } | 110 } |
117 | 111 |
118 gpu::ImageFactory* GpuMemoryBufferFactoryOzoneNativeBuffer::AsImageFactory() { | 112 gpu::ImageFactory* GpuMemoryBufferFactoryOzoneNativeBuffer::AsImageFactory() { |
119 return this; | 113 return this; |
120 } | 114 } |
121 | 115 |
122 scoped_refptr<gfx::GLImage> | 116 scoped_refptr<gfx::GLImage> |
123 GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForGpuMemoryBuffer( | 117 GpuMemoryBufferFactoryOzoneNativeBuffer::CreateImageForGpuMemoryBuffer( |
124 const gfx::GpuMemoryBufferHandle& handle, | 118 const gfx::GpuMemoryBufferHandle& handle, |
125 const gfx::Size& size, | 119 const gfx::Size& size, |
126 gfx::GpuMemoryBuffer::Format format, | 120 gfx::GpuMemoryBuffer::Format format, |
127 unsigned internalformat, | 121 unsigned internalformat, |
128 int client_id) { | 122 int client_id) { |
129 DCHECK_EQ(handle.type, gfx::OZONE_NATIVE_BUFFER); | 123 DCHECK_EQ(handle.type, gfx::OZONE_NATIVE_BUFFER); |
130 return ozone_native_buffer_factory_.CreateImageForGpuMemoryBuffer( | 124 return ozone_native_buffer_factory_.CreateImageForGpuMemoryBuffer( |
131 handle.id, size, format, internalformat, client_id); | 125 handle.id, size, format, internalformat, client_id); |
132 } | 126 } |
133 | 127 |
134 } // namespace content | 128 } // namespace content |
OLD | NEW |