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 #ifndef GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 5 #ifndef GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
6 #define GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 6 #define GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 // should match what was used to allocate the |handle|. |callback| is | 27 // should match what was used to allocate the |handle|. |callback| is |
28 // called when instance is deleted, which is not necessarily on the same | 28 // called when instance is deleted, which is not necessarily on the same |
29 // thread as this function was called on and instance was created on. | 29 // thread as this function was called on and instance was created on. |
30 static std::unique_ptr<GpuMemoryBufferImpl> CreateFromHandle( | 30 static std::unique_ptr<GpuMemoryBufferImpl> CreateFromHandle( |
31 const gfx::GpuMemoryBufferHandle& handle, | 31 const gfx::GpuMemoryBufferHandle& handle, |
32 const gfx::Size& size, | 32 const gfx::Size& size, |
33 gfx::BufferFormat format, | 33 gfx::BufferFormat format, |
34 gfx::BufferUsage usage, | 34 gfx::BufferUsage usage, |
35 const DestructionCallback& callback); | 35 const DestructionCallback& callback); |
36 | 36 |
37 // Type-checking upcast routine. Returns an NULL on failure. | |
38 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); | |
39 | |
40 // Overridden from gfx::GpuMemoryBuffer: | 37 // Overridden from gfx::GpuMemoryBuffer: |
41 gfx::Size GetSize() const override; | 38 gfx::Size GetSize() const override; |
42 gfx::BufferFormat GetFormat() const override; | 39 gfx::BufferFormat GetFormat() const override; |
43 gfx::GpuMemoryBufferId GetId() const override; | 40 gfx::GpuMemoryBufferId GetId() const override; |
44 ClientBuffer AsClientBuffer() override; | 41 ClientBuffer AsClientBuffer() override; |
45 | 42 |
46 void set_destruction_sync_token(const gpu::SyncToken& sync_token) { | 43 void set_destruction_sync_token(const gpu::SyncToken& sync_token) { |
47 destruction_sync_token_ = sync_token; | 44 destruction_sync_token_ = sync_token; |
48 } | 45 } |
49 | 46 |
(...skipping 10 matching lines...) Expand all Loading... |
60 bool mapped_; | 57 bool mapped_; |
61 gpu::SyncToken destruction_sync_token_; | 58 gpu::SyncToken destruction_sync_token_; |
62 | 59 |
63 private: | 60 private: |
64 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | 61 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
65 }; | 62 }; |
66 | 63 |
67 } // namespace gpu | 64 } // namespace gpu |
68 | 65 |
69 #endif // GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 66 #endif // GPU_IPC_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
OLD | NEW |