Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: content/common/gpu/gpu_memory_buffer_factory.cc

Issue 1389133002: content: Use type-parameterized tests for GpuMemoryBuffer implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add blankline Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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::CreateNativeType() {
44 gfx::GpuMemoryBufferType type) {
45 switch (type) {
46 case gfx::SHARED_MEMORY_BUFFER:
47 return make_scoped_ptr(new GpuMemoryBufferFactorySharedMemory);
48 #if defined(OS_MACOSX) 39 #if defined(OS_MACOSX)
49 case gfx::IO_SURFACE_BUFFER: 40 return make_scoped_ptr(new GpuMemoryBufferFactoryIOSurface);
50 return make_scoped_ptr(new GpuMemoryBufferFactoryIOSurface);
51 #endif 41 #endif
52 #if defined(OS_ANDROID) 42 #if defined(OS_ANDROID)
53 case gfx::SURFACE_TEXTURE_BUFFER: 43 return make_scoped_ptr(new GpuMemoryBufferFactorySurfaceTexture);
54 return make_scoped_ptr(new GpuMemoryBufferFactorySurfaceTexture);
55 #endif 44 #endif
56 #if defined(USE_OZONE) 45 #if defined(USE_OZONE)
57 case gfx::OZONE_NATIVE_PIXMAP: 46 return make_scoped_ptr(new GpuMemoryBufferFactoryOzoneNativePixmap);
58 return make_scoped_ptr(new GpuMemoryBufferFactoryOzoneNativePixmap);
59 #endif 47 #endif
60 default: 48 NOTREACHED();
61 NOTREACHED(); 49 return nullptr;
62 return scoped_ptr<GpuMemoryBufferFactory>();
63 }
64 } 50 }
65 51
66 } // namespace content 52 } // namespace content
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_memory_buffer_factory.h ('k') | content/common/gpu/gpu_memory_buffer_factory_io_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698