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