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 "ui/gl/gl_bindings.h" | 7 #include "ui/gl/gl_bindings.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 GpuMemoryBufferImpl::GpuMemoryBufferImpl(const gfx::Size& size, | 11 GpuMemoryBufferImpl::GpuMemoryBufferImpl(const gfx::Size& size, |
12 Format format, | 12 Format format, |
13 const DestructionCallback& callback) | 13 const DestructionCallback& callback) |
14 : size_(size), format_(format), callback_(callback), mapped_(false) { | 14 : size_(size), |
| 15 format_(format), |
| 16 callback_(callback), |
| 17 mapped_(false), |
| 18 destruction_sync_point_(0) { |
15 } | 19 } |
16 | 20 |
17 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { | 21 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { |
18 callback_.Run(); | 22 callback_.Run(destruction_sync_point_); |
19 } | 23 } |
20 | 24 |
21 // static | 25 // static |
22 GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer( | 26 GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer( |
23 ClientBuffer buffer) { | 27 ClientBuffer buffer) { |
24 return reinterpret_cast<GpuMemoryBufferImpl*>(buffer); | 28 return reinterpret_cast<GpuMemoryBufferImpl*>(buffer); |
25 } | 29 } |
26 | 30 |
27 // static | 31 // static |
28 size_t GpuMemoryBufferImpl::BytesPerPixel(Format format) { | 32 size_t GpuMemoryBufferImpl::BytesPerPixel(Format format) { |
(...skipping 14 matching lines...) Expand all Loading... |
43 | 47 |
44 bool GpuMemoryBufferImpl::IsMapped() const { | 48 bool GpuMemoryBufferImpl::IsMapped() const { |
45 return mapped_; | 49 return mapped_; |
46 } | 50 } |
47 | 51 |
48 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 52 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { |
49 return reinterpret_cast<ClientBuffer>(this); | 53 return reinterpret_cast<ClientBuffer>(this); |
50 } | 54 } |
51 | 55 |
52 } // namespace content | 56 } // namespace content |
OLD | NEW |