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 "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" |
9 | 9 |
10 #if defined(OS_MACOSX) | 10 #if defined(OS_MACOSX) |
(...skipping 11 matching lines...) Expand all Loading... |
22 namespace content { | 22 namespace content { |
23 | 23 |
24 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, | 24 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, |
25 const gfx::Size& size, | 25 const gfx::Size& size, |
26 gfx::BufferFormat format, | 26 gfx::BufferFormat format, |
27 const DestructionCallback& callback) | 27 const DestructionCallback& callback) |
28 : id_(id), | 28 : id_(id), |
29 size_(size), | 29 size_(size), |
30 format_(format), | 30 format_(format), |
31 callback_(callback), | 31 callback_(callback), |
32 mapped_(false), | 32 mapped_(false) {} |
33 destruction_sync_point_(0) {} | |
34 | 33 |
35 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { | 34 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() { |
36 DCHECK(!mapped_); | 35 DCHECK(!mapped_); |
37 callback_.Run(destruction_sync_point_); | 36 callback_.Run(destruction_sync_token_); |
38 } | 37 } |
39 | 38 |
40 // static | 39 // static |
41 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( | 40 scoped_ptr<GpuMemoryBufferImpl> GpuMemoryBufferImpl::CreateFromHandle( |
42 const gfx::GpuMemoryBufferHandle& handle, | 41 const gfx::GpuMemoryBufferHandle& handle, |
43 const gfx::Size& size, | 42 const gfx::Size& size, |
44 gfx::BufferFormat format, | 43 gfx::BufferFormat format, |
45 gfx::BufferUsage usage, | 44 gfx::BufferUsage usage, |
46 const DestructionCallback& callback) { | 45 const DestructionCallback& callback) { |
47 switch (handle.type) { | 46 switch (handle.type) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 84 |
86 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { | 85 gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const { |
87 return id_; | 86 return id_; |
88 } | 87 } |
89 | 88 |
90 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { | 89 ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() { |
91 return reinterpret_cast<ClientBuffer>(this); | 90 return reinterpret_cast<ClientBuffer>(this); |
92 } | 91 } |
93 | 92 |
94 } // namespace content | 93 } // namespace content |
OLD | NEW |