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

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

Issue 1139903005: Add PERSISTENT_MAP usage for GpuMemoryBuffers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: persistentmap: . Created 5 years, 7 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" 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_buffer.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 gfx::GpuMemoryBuffer::Usage usage,
26 std::vector<gfx::GpuMemoryBufferType>* types) { 27 std::vector<gfx::GpuMemoryBufferType>* types) {
27 const gfx::GpuMemoryBufferType supported_types[] = { 28 switch (usage) {
29 case gfx::GpuMemoryBuffer::PERSISTENT_MAP: {
30 // TODO(reveman): PERSISTENT_MAP is only supported by shared memory
31 // buffers. crbug.com/489438
32 const gfx::GpuMemoryBufferType supported_types[] = {
33 gfx::SHARED_MEMORY_BUFFER};
34 types->assign(supported_types,
35 supported_types + arraysize(supported_types));
36 break;
37 }
38 case gfx::GpuMemoryBuffer::MAP:
39 case gfx::GpuMemoryBuffer::SCANOUT: {
40 const gfx::GpuMemoryBufferType supported_types[] = {
28 #if defined(OS_MACOSX) 41 #if defined(OS_MACOSX)
29 gfx::IO_SURFACE_BUFFER, 42 gfx::IO_SURFACE_BUFFER,
30 #endif 43 #endif
31 #if defined(OS_ANDROID) 44 #if defined(OS_ANDROID)
32 gfx::SURFACE_TEXTURE_BUFFER, 45 gfx::SURFACE_TEXTURE_BUFFER,
33 #endif 46 #endif
34 #if defined(USE_OZONE) 47 #if defined(USE_OZONE)
35 gfx::OZONE_NATIVE_BUFFER, 48 gfx::OZONE_NATIVE_BUFFER,
36 #endif 49 #endif
37 gfx::SHARED_MEMORY_BUFFER 50 gfx::SHARED_MEMORY_BUFFER
38 }; 51 };
39 types->assign(supported_types, supported_types + arraysize(supported_types)); 52 types->assign(supported_types,
53 supported_types + arraysize(supported_types));
54 break;
55 }
56 }
40 } 57 }
41 58
42 // static 59 // static
43 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create( 60 scoped_ptr<GpuMemoryBufferFactory> GpuMemoryBufferFactory::Create(
44 gfx::GpuMemoryBufferType type) { 61 gfx::GpuMemoryBufferType type) {
45 switch (type) { 62 switch (type) {
46 case gfx::SHARED_MEMORY_BUFFER: 63 case gfx::SHARED_MEMORY_BUFFER:
47 return make_scoped_ptr(new GpuMemoryBufferFactorySharedMemory); 64 return make_scoped_ptr(new GpuMemoryBufferFactorySharedMemory);
48 #if defined(OS_MACOSX) 65 #if defined(OS_MACOSX)
49 case gfx::IO_SURFACE_BUFFER: 66 case gfx::IO_SURFACE_BUFFER:
50 return make_scoped_ptr(new GpuMemoryBufferFactoryIOSurface); 67 return make_scoped_ptr(new GpuMemoryBufferFactoryIOSurface);
51 #endif 68 #endif
52 #if defined(OS_ANDROID) 69 #if defined(OS_ANDROID)
53 case gfx::SURFACE_TEXTURE_BUFFER: 70 case gfx::SURFACE_TEXTURE_BUFFER:
54 return make_scoped_ptr(new GpuMemoryBufferFactorySurfaceTexture); 71 return make_scoped_ptr(new GpuMemoryBufferFactorySurfaceTexture);
55 #endif 72 #endif
56 #if defined(USE_OZONE) 73 #if defined(USE_OZONE)
57 case gfx::OZONE_NATIVE_BUFFER: 74 case gfx::OZONE_NATIVE_BUFFER:
58 return make_scoped_ptr(new GpuMemoryBufferFactoryOzoneNativeBuffer); 75 return make_scoped_ptr(new GpuMemoryBufferFactoryOzoneNativeBuffer);
59 #endif 76 #endif
60 default: 77 default:
61 NOTREACHED(); 78 NOTREACHED();
62 return scoped_ptr<GpuMemoryBufferFactory>(); 79 return scoped_ptr<GpuMemoryBufferFactory>();
63 } 80 }
64 } 81 }
65 82
66 } // namespace content 83 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698