OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains the definition of the RingBuffer class. | 5 // This file contains the definition of the RingBuffer class. |
6 | 6 |
7 #ifndef GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ | 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ |
8 #define GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ | 8 #define GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
| 11 |
| 12 #include "../../gpu_export.h" |
11 #include "../common/logging.h" | 13 #include "../common/logging.h" |
12 #include "../common/types.h" | 14 #include "../common/types.h" |
13 | 15 |
14 namespace gpu { | 16 namespace gpu { |
15 class CommandBufferHelper; | 17 class CommandBufferHelper; |
16 | 18 |
17 // RingBuffer manages a piece of memory as a ring buffer. Memory is allocated | 19 // RingBuffer manages a piece of memory as a ring buffer. Memory is allocated |
18 // with Alloc and then a is freed pending a token with FreePendingToken. Old | 20 // with Alloc and then a is freed pending a token with FreePendingToken. Old |
19 // allocations must not be kept past new allocations. | 21 // allocations must not be kept past new allocations. |
20 class RingBuffer { | 22 class GPU_EXPORT RingBuffer { |
21 public: | 23 public: |
22 typedef unsigned int Offset; | 24 typedef unsigned int Offset; |
23 | 25 |
24 // Creates a RingBuffer. | 26 // Creates a RingBuffer. |
25 // Parameters: | 27 // Parameters: |
26 // base_offset: The offset of the start of the buffer. | 28 // base_offset: The offset of the start of the buffer. |
27 // size: The size of the buffer in bytes. | 29 // size: The size of the buffer in bytes. |
28 // helper: A CommandBufferHelper for dealing with tokens. | 30 // helper: A CommandBufferHelper for dealing with tokens. |
29 RingBuffer( | 31 RingBuffer( |
30 Offset base_offset, unsigned int size, CommandBufferHelper* helper); | 32 Offset base_offset, unsigned int size, CommandBufferHelper* helper); |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 | 189 |
188 private: | 190 private: |
189 RingBuffer allocator_; | 191 RingBuffer allocator_; |
190 void* base_; | 192 void* base_; |
191 DISALLOW_IMPLICIT_CONSTRUCTORS(RingBufferWrapper); | 193 DISALLOW_IMPLICIT_CONSTRUCTORS(RingBufferWrapper); |
192 }; | 194 }; |
193 | 195 |
194 } // namespace gpu | 196 } // namespace gpu |
195 | 197 |
196 #endif // GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ | 198 #endif // GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ |
OLD | NEW |