| 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 "base/memory/ptr_util.h" | 
| 8 #include "build/build_config.h" | 9 #include "build/build_config.h" | 
| 9 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" | 10 #include "gpu/ipc/client/gpu_memory_buffer_impl_shared_memory.h" | 
| 10 | 11 | 
| 11 #if defined(OS_MACOSX) | 12 #if defined(OS_MACOSX) | 
| 12 #include "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h" | 13 #include "gpu/ipc/client/gpu_memory_buffer_impl_io_surface.h" | 
| 13 #endif | 14 #endif | 
| 14 | 15 | 
| 15 #if defined(OS_LINUX) | 16 #if defined(OS_LINUX) | 
| 16 #include "gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.h" | 17 #include "gpu/ipc/client/gpu_memory_buffer_impl_native_pixmap.h" | 
| 17 #endif | 18 #endif | 
| 18 | 19 | 
|  | 20 #if defined(OS_WIN) | 
|  | 21 #include "gpu/ipc/client/gpu_memory_buffer_impl_direct_composition.h" | 
|  | 22 #endif | 
|  | 23 | 
| 19 namespace gpu { | 24 namespace gpu { | 
| 20 | 25 | 
| 21 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, | 26 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, | 
| 22                                          const gfx::Size& size, | 27                                          const gfx::Size& size, | 
| 23                                          gfx::BufferFormat format, | 28                                          gfx::BufferFormat format, | 
| 24                                          const DestructionCallback& callback) | 29                                          const DestructionCallback& callback) | 
| 25     : id_(id), | 30     : id_(id), | 
| 26       size_(size), | 31       size_(size), | 
| 27       format_(format), | 32       format_(format), | 
| 28       callback_(callback), | 33       callback_(callback), | 
| (...skipping 19 matching lines...) Expand all  Loading... | 
| 48 #if defined(OS_MACOSX) | 53 #if defined(OS_MACOSX) | 
| 49     case gfx::IO_SURFACE_BUFFER: | 54     case gfx::IO_SURFACE_BUFFER: | 
| 50       return GpuMemoryBufferImplIOSurface::CreateFromHandle( | 55       return GpuMemoryBufferImplIOSurface::CreateFromHandle( | 
| 51           handle, size, format, usage, callback); | 56           handle, size, format, usage, callback); | 
| 52 #endif | 57 #endif | 
| 53 #if defined(OS_LINUX) | 58 #if defined(OS_LINUX) | 
| 54     case gfx::NATIVE_PIXMAP: | 59     case gfx::NATIVE_PIXMAP: | 
| 55       return GpuMemoryBufferImplNativePixmap::CreateFromHandle( | 60       return GpuMemoryBufferImplNativePixmap::CreateFromHandle( | 
| 56           handle, size, format, usage, callback); | 61           handle, size, format, usage, callback); | 
| 57 #endif | 62 #endif | 
|  | 63 #if defined(OS_WIN) | 
|  | 64     case gfx::DIRECT_COMPOSITION: | 
|  | 65       return base::MakeUnique<GpuMemoryBufferImplDirectComposition>( | 
|  | 66           size, handle, format, callback); | 
|  | 67 #endif | 
| 58     default: | 68     default: | 
| 59       NOTREACHED(); | 69       NOTREACHED(); | 
| 60       return nullptr; | 70       return nullptr; | 
| 61   } | 71   } | 
| 62 } | 72 } | 
| 63 | 73 | 
| 64 gfx::Size GpuMemoryBufferImpl::GetSize() const { | 74 gfx::Size GpuMemoryBufferImpl::GetSize() const { | 
| 65   return size_; | 75   return size_; | 
| 66 } | 76 } | 
| 67 | 77 | 
| 68 gfx::BufferFormat GpuMemoryBufferImpl::GetFormat() const { | 78 gfx::BufferFormat GpuMemoryBufferImpl::GetFormat() const { | 
| 69   return format_; | 79   return format_; | 
| 70 } | 80 } | 
| 71 | 81 | 
| 72 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { | 82 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { | 
| 73   return id_; | 83   return id_; | 
| 74 } | 84 } | 
| 75 | 85 | 
| 76 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 86 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 
| 77   return reinterpret_cast<ClientBuffer>(this); | 87   return reinterpret_cast<ClientBuffer>(this); | 
| 78 } | 88 } | 
| 79 | 89 | 
| 80 }  // namespace gpu | 90 }  // namespace gpu | 
| OLD | NEW | 
|---|