OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/client/gpu_memory_buffer_impl.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
6 | 6 |
7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shm.h" | 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_shm.h" |
8 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" |
9 | 9 |
10 namespace content { | 10 namespace content { |
11 | 11 |
12 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( | 12 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( |
13 gfx::GpuMemoryBufferHandle handle, | 13 gfx::GpuMemoryBufferHandle handle, |
14 gfx::Size size, | 14 gfx::Size size, |
15 unsigned internalformat) { | 15 unsigned internalformat, |
16 gfx::GpuMemoryBuffer::Usage usage) { | |
17 if (usage == gfx::GpuMemoryBuffer::SCANOUT) | |
reveman
2014/04/30 11:31:28
I don't think this should be here. If the browser
| |
18 return scoped_ptr<GpuMemoryBufferImpl>(); | |
19 | |
16 switch (handle.type) { | 20 switch (handle.type) { |
17 case gfx::SHARED_MEMORY_BUFFER: { | 21 case gfx::SHARED_MEMORY_BUFFER: { |
18 scoped_ptr<GpuMemoryBufferImplShm> buffer( | 22 scoped_ptr<GpuMemoryBufferImplShm> buffer( |
19 new GpuMemoryBufferImplShm(size, internalformat)); | 23 new GpuMemoryBufferImplShm(size, internalformat)); |
20 if (!buffer->Initialize(handle)) | 24 if (!buffer->Initialize(handle)) |
21 return scoped_ptr<GpuMemoryBufferImpl>(); | 25 return scoped_ptr<GpuMemoryBufferImpl>(); |
22 | 26 |
23 return buffer.PassAs<GpuMemoryBufferImpl>(); | 27 return buffer.PassAs<GpuMemoryBufferImpl>(); |
24 } | 28 } |
25 case gfx::SURFACE_TEXTURE_BUFFER: { | 29 case gfx::SURFACE_TEXTURE_BUFFER: { |
26 scoped_ptr<GpuMemoryBufferImplSurfaceTexture> buffer( | 30 scoped_ptr<GpuMemoryBufferImplSurfaceTexture> buffer( |
27 new GpuMemoryBufferImplSurfaceTexture(size, internalformat)); | 31 new GpuMemoryBufferImplSurfaceTexture(size, internalformat)); |
28 if (!buffer->Initialize(handle)) | 32 if (!buffer->Initialize(handle)) |
29 return scoped_ptr<GpuMemoryBufferImpl>(); | 33 return scoped_ptr<GpuMemoryBufferImpl>(); |
30 | 34 |
31 return buffer.PassAs<GpuMemoryBufferImpl>(); | 35 return buffer.PassAs<GpuMemoryBufferImpl>(); |
32 } | 36 } |
33 default: | 37 default: |
34 return scoped_ptr<GpuMemoryBufferImpl>(); | 38 return scoped_ptr<GpuMemoryBufferImpl>(); |
35 } | 39 } |
36 } | 40 } |
37 | 41 |
38 } // namespace content | 42 } // namespace content |
OLD | NEW |