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