| 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/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_ozone_native_buffer.h
" | 7 #include "content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_buffer.h
" |
| 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
| 9 | 9 |
| 10 namespace content { | 10 namespace content { |
| 11 | 11 |
| 12 // static | 12 // static |
| 13 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( | 13 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::Create( |
| 14 const gfx::Size& size, | 14 const gfx::Size& size, |
| 15 unsigned internalformat, | 15 unsigned internalformat, |
| 16 unsigned usage) { | 16 unsigned usage) { |
| 17 if (GpuMemoryBufferImplOzoneNativeBuffer::IsConfigurationSupported( |
| 18 internalformat, usage)) { |
| 19 return GpuMemoryBufferImplOzoneNativeBuffer:: |
| 20 AllocateOzoneNativeBufferForBrowser( |
| 21 size, internalformat, usage, child_id, callback); |
| 22 } |
| 17 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( | 23 if (GpuMemoryBufferImplSharedMemory::IsConfigurationSupported( |
| 18 size, internalformat, usage)) { | 24 size, internalformat, usage)) { |
| 19 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( | 25 scoped_ptr<GpuMemoryBufferImplSharedMemory> buffer( |
| 20 new GpuMemoryBufferImplSharedMemory(size, internalformat)); | 26 new GpuMemoryBufferImplSharedMemory(size, internalformat)); |
| 21 if (!buffer->Initialize()) | 27 if (!buffer->Initialize()) |
| 22 return scoped_ptr<GpuMemoryBufferImpl>(); | 28 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 23 | 29 |
| 24 return buffer.PassAs<GpuMemoryBufferImpl>(); | 30 return buffer.PassAs<GpuMemoryBufferImpl>(); |
| 25 } | 31 } |
| 26 | 32 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 return scoped_ptr<GpuMemoryBufferImpl>(); | 85 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 80 | 86 |
| 81 return buffer.PassAs<GpuMemoryBufferImpl>(); | 87 return buffer.PassAs<GpuMemoryBufferImpl>(); |
| 82 } | 88 } |
| 83 default: | 89 default: |
| 84 return scoped_ptr<GpuMemoryBufferImpl>(); | 90 return scoped_ptr<GpuMemoryBufferImpl>(); |
| 85 } | 91 } |
| 86 } | 92 } |
| 87 | 93 |
| 88 } // namespace content | 94 } // namespace content |
| OLD | NEW |