| 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 "gpu/ipc/client/gpu_memory_buffer_impl.h" | 5 #include "gpu/ipc/client/gpu_memory_buffer_impl.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" | 9 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" |
| 10 | 10 |
| 11 #if defined(OS_MACOSX) | 11 #if defined(OS_MACOSX) |
| 12 #include "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h" | 12 #include "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h" |
| 13 #endif | 13 #endif |
| 14 | 14 |
| 15 #if defined(USE_OZONE) | 15 #if defined(OS_LINUX) |
| 16 #include "gpu/ipc/client/gpu_memory_buffer_impl_ozone_native_pixmap.h" | 16 #include "gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.h" |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 namespace gpu { | 19 namespace gpu { |
| 20 | 20 |
| 21 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, | 21 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, |
| 22 const gfx::Size& size, | 22 const gfx::Size& size, |
| 23 gfx::BufferFormat format, | 23 gfx::BufferFormat format, |
| 24 const DestructionCallback& callback) | 24 const DestructionCallback& callback) |
| 25 : id_(id), | 25 : id_(id), |
| 26 size_(size), | 26 size_(size), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 43 const DestructionCallback& callback) { | 43 const DestructionCallback& callback) { |
| 44 switch (handle.type) { | 44 switch (handle.type) { |
| 45 case gfx::SHARED_MEMORY_BUFFER: | 45 case gfx::SHARED_MEMORY_BUFFER: |
| 46 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( | 46 return GpuMemoryBufferImplSharedMemory::CreateFromHandle( |
| 47 handle, size, format, usage, callback); | 47 handle, size, format, usage, callback); |
| 48 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
| 49 case gfx::IO_SURFACE_BUFFER: | 49 case gfx::IO_SURFACE_BUFFER: |
| 50 return GpuMemoryBufferImplIOSurface::CreateFromHandle( | 50 return GpuMemoryBufferImplIOSurface::CreateFromHandle( |
| 51 handle, size, format, usage, callback); | 51 handle, size, format, usage, callback); |
| 52 #endif | 52 #endif |
| 53 #if defined(USE_OZONE) | 53 #if defined(OS_LINUX) |
| 54 case gfx::NATIVE_PIXMAP: | 54 case gfx::NATIVE_PIXMAP: |
| 55 return GpuMemoryBufferImplOzoneNativePixmap::CreateFromHandle( | 55 return GpuMemoryBufferImplNativePixmap::CreateFromHandle( |
| 56 handle, size, format, usage, callback); | 56 handle, size, format, usage, callback); |
| 57 #endif | 57 #endif |
| 58 default: | 58 default: |
| 59 NOTREACHED(); | 59 NOTREACHED(); |
| 60 return nullptr; | 60 return nullptr; |
| 61 } | 61 } |
| 62 } | 62 } |
| 63 | 63 |
| 64 gfx::Size GpuMemoryBufferImpl::GetSize() const { | 64 gfx::Size GpuMemoryBufferImpl::GetSize() const { |
| 65 return size_; | 65 return size_; |
| 66 } | 66 } |
| 67 | 67 |
| 68 gfx::BufferFormat GpuMemoryBufferImpl::GetFormat() const { | 68 gfx::BufferFormat GpuMemoryBufferImpl::GetFormat() const { |
| 69 return format_; | 69 return format_; |
| 70 } | 70 } |
| 71 | 71 |
| 72 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { | 72 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { |
| 73 return id_; | 73 return id_; |
| 74 } | 74 } |
| 75 | 75 |
| 76 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 76 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { |
| 77 return reinterpret_cast<ClientBuffer>(this); | 77 return reinterpret_cast<ClientBuffer>(this); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace gpu | 80 } // namespace gpu |
| OLD | NEW |