| 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.h" | 5 #include "content/common/gpu/gpu_memory_buffer_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/common/gpu/gpu_memory_buffer_factory_shared_memory.h" | |
| 9 | 8 |
| 10 #if defined(OS_MACOSX) | 9 #if defined(OS_MACOSX) |
| 11 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" | 10 #include "content/common/gpu/gpu_memory_buffer_factory_io_surface.h" |
| 12 #endif | 11 #endif |
| 13 | 12 |
| 14 #if defined(OS_ANDROID) | 13 #if defined(OS_ANDROID) |
| 15 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" | 14 #include "content/common/gpu/gpu_memory_buffer_factory_surface_texture.h" |
| 16 #endif | 15 #endif |
| 17 | 16 |
| 18 #if defined(USE_OZONE) | 17 #if defined(USE_OZONE) |
| 19 #include "content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h" | 18 #include "content/common/gpu/gpu_memory_buffer_factory_ozone_native_pixmap.h" |
| 20 #endif | 19 #endif |
| 21 | 20 |
| 22 namespace content { | 21 namespace content { |
| 23 | 22 |
| 24 // static | 23 // static |
| 25 void GpuMemoryBufferFactory::GetSupportedTypes( | 24 gfx::GpuMemoryBufferType GpuMemoryBufferFactory::GetNativeType() { |
| 26 std::vector<gfx::GpuMemoryBufferType>* types) { | |
| 27 const gfx::GpuMemoryBufferType supported_types[] = { | |
| 28 #if defined(OS_MACOSX) | 25 #if defined(OS_MACOSX) |
| 29 gfx::IO_SURFACE_BUFFER, | 26 return gfx::IO_SURFACE_BUFFER; |
| 30 #endif | 27 #endif |
| 31 #if defined(OS_ANDROID) | 28 #if defined(OS_ANDROID) |
| 32 gfx::SURFACE_TEXTURE_BUFFER, | 29 return gfx::SURFACE_TEXTURE_BUFFER; |
| 33 #endif | 30 #endif |
| 34 #if defined(USE_OZONE) | 31 #if defined(USE_OZONE) |
| 35 gfx::OZONE_NATIVE_PIXMAP, | 32 return gfx::OZONE_NATIVE_PIXMAP; |
| 36 #endif | 33 #endif |
| 37 gfx::SHARED_MEMORY_BUFFER | 34 return gfx::EMPTY_BUFFER; |
| 38 }; | |
| 39 types->assign(supported_types, supported_types + arraysize(supported_types)); | |
| 40 } | 35 } |
| 41 | 36 |
| 42 // static | 37 // static |
| 43 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create( | 38 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create( |
| 44 gfx::GpuMemoryBufferType type) { | 39 gfx::GpuMemoryBufferType type) { |
| 45 switch (type) { | 40 switch (type) { |
| 46 case gfx::SHARED_MEMORY_BUFFER: | |
| 47 return make_scoped_ptr(new GpuMemoryBufferFactorySharedMemory); | |
| 48 #if defined(OS_MACOSX) | 41 #if defined(OS_MACOSX) |
| 49 case gfx::IO_SURFACE_BUFFER: | 42 case gfx::IO_SURFACE_BUFFER: |
| 50 return make_scoped_ptr(new GpuMemoryBufferFactoryIOSurface); | 43 return make_scoped_ptr(new GpuMemoryBufferFactoryIOSurface); |
| 51 #endif | 44 #endif |
| 52 #if defined(OS_ANDROID) | 45 #if defined(OS_ANDROID) |
| 53 case gfx::SURFACE_TEXTURE_BUFFER: | 46 case gfx::SURFACE_TEXTURE_BUFFER: |
| 54 return make_scoped_ptr(new GpuMemoryBufferFactorySurfaceTexture); | 47 return make_scoped_ptr(new GpuMemoryBufferFactorySurfaceTexture); |
| 55 #endif | 48 #endif |
| 56 #if defined(USE_OZONE) | 49 #if defined(USE_OZONE) |
| 57 case gfx::OZONE_NATIVE_PIXMAP: | 50 case gfx::OZONE_NATIVE_PIXMAP: |
| 58 return make_scoped_ptr(new GpuMemoryBufferFactoryOzoneNativePixmap); | 51 return make_scoped_ptr(new GpuMemoryBufferFactoryOzoneNativePixmap); |
| 59 #endif | 52 #endif |
| 60 default: | 53 default: |
| 61 NOTREACHED(); | 54 NOTREACHED(); |
| 62 return scoped_ptr<GpuMemoryBufferFactory>(); | 55 return nullptr; |
| 63 } | 56 } |
| 64 } | 57 } |
| 65 | 58 |
| 66 } // namespace content | 59 } // namespace content |
| OLD | NEW |