| 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 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 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), |
| 27 format_(format), | 27 format_(format), |
| 28 callback_(callback), | 28 callback_(callback), |
| 29 mapped_(false) {} | 29 mapped_(false) {} |
| 30 | 30 |
| 31 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { | 31 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { |
| 32 DCHECK(!mapped_); | 32 DCHECK(!mapped_); |
| 33 callback_.Run(destruction_sync_token_); | 33 if (!callback_.is_null()) |
| 34 callback_.Run(destruction_sync_token_); |
| 34 } | 35 } |
| 35 | 36 |
| 36 // static | 37 // static |
| 37 std::unique_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( | 38 std::unique_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
| 38 const gfx::GpuMemoryBufferHandle& handle, | 39 const gfx::GpuMemoryBufferHandle& handle, |
| 39 const gfx::Size& size, | 40 const gfx::Size& size, |
| 40 gfx::BufferFormat format, | 41 gfx::BufferFormat format, |
| 41 gfx::BufferUsage usage, | 42 gfx::BufferUsage usage, |
| 42 const DestructionCallback& callback) { | 43 const DestructionCallback& callback) { |
| 43 switch (handle.type) { | 44 switch (handle.type) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 70 | 71 |
| 71 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { | 72 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { |
| 72 return id_; | 73 return id_; |
| 73 } | 74 } |
| 74 | 75 |
| 75 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 76 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { |
| 76 return reinterpret_cast<ClientBuffer>(this); | 77 return reinterpret_cast<ClientBuffer>(this); |
| 77 } | 78 } |
| 78 | 79 |
| 79 } // namespace gpu | 80 } // namespace gpu |
| OLD | NEW |