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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/numerics/safe_math.h" | 8 #include "base/numerics/safe_math.h" |
9 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" | 9 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
10 #include "ui/gl/gl_bindings.h" | 10 #include "ui/gl/gl_bindings.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 const DestructionCallback& callback) | 29 const DestructionCallback& callback) |
30 : id_(id), | 30 : id_(id), |
31 size_(size), | 31 size_(size), |
32 format_(format), | 32 format_(format), |
33 callback_(callback), | 33 callback_(callback), |
34 mapped_(false), | 34 mapped_(false), |
35 destruction_sync_point_(0) { | 35 destruction_sync_point_(0) { |
36 } | 36 } |
37 | 37 |
38 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { | 38 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { |
| 39 DCHECK(!mapped_); |
39 callback_.Run(destruction_sync_point_); | 40 callback_.Run(destruction_sync_point_); |
40 } | 41 } |
41 | 42 |
42 // static | 43 // static |
43 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( | 44 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
44 const gfx::GpuMemoryBufferHandle& handle, | 45 const gfx::GpuMemoryBufferHandle& handle, |
45 const gfx::Size& size, | 46 const gfx::Size& size, |
46 Format format, | 47 Format format, |
47 const DestructionCallback& callback) { | 48 const DestructionCallback& callback) { |
48 switch (handle.type) { | 49 switch (handle.type) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 172 |
172 bool GpuMemoryBufferImpl::IsMapped() const { | 173 bool GpuMemoryBufferImpl::IsMapped() const { |
173 return mapped_; | 174 return mapped_; |
174 } | 175 } |
175 | 176 |
176 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 177 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { |
177 return reinterpret_cast<ClientBuffer>(this); | 178 return reinterpret_cast<ClientBuffer>(this); |
178 } | 179 } |
179 | 180 |
180 } // namespace content | 181 } // namespace content |
OLD | NEW |