| 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> |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 void* Alloc(unsigned int size); | 47 void* Alloc(unsigned int size); |
| 48 | 48 |
| 49 // Frees a block of memory, pending the passage of a token. That memory won't | 49 // Frees a block of memory, pending the passage of a token. That memory won't |
| 50 // be re-allocated until the token has passed through the command stream. | 50 // be re-allocated until the token has passed through the command stream. |
| 51 // | 51 // |
| 52 // Parameters: | 52 // Parameters: |
| 53 // pointer: the pointer to the memory block to free. | 53 // pointer: the pointer to the memory block to free. |
| 54 // token: the token value to wait for before re-using the memory. | 54 // token: the token value to wait for before re-using the memory. |
| 55 void FreePendingToken(void* pointer, unsigned int token); | 55 void FreePendingToken(void* pointer, unsigned int token); |
| 56 | 56 |
| 57 // Discards a block within the ring buffer. |
| 58 // |
| 59 // Parameters: |
| 60 // pointer: the pointer to the memory block to free. |
| 61 void DiscardBlock(void* pointer); |
| 62 |
| 57 // Gets the size of the largest free block that is available without waiting. | 63 // Gets the size of the largest free block that is available without waiting. |
| 58 unsigned int GetLargestFreeSizeNoWaiting(); | 64 unsigned int GetLargestFreeSizeNoWaiting(); |
| 59 | 65 |
| 60 // Gets the size of the largest free block that can be allocated if the | 66 // Gets the size of the largest free block that can be allocated if the |
| 61 // caller can wait. Allocating a block of this size will succeed, but may | 67 // caller can wait. Allocating a block of this size will succeed, but may |
| 62 // block. | 68 // block. |
| 63 unsigned int GetLargestFreeOrPendingSize() { | 69 unsigned int GetLargestFreeOrPendingSize() { |
| 64 return size_; | 70 return size_; |
| 65 } | 71 } |
| 66 | 72 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 | 134 |
| 129 // The physical address that corresponds to base_offset. | 135 // The physical address that corresponds to base_offset. |
| 130 void* base_; | 136 void* base_; |
| 131 | 137 |
| 132 DISALLOW_IMPLICIT_CONSTRUCTORS(RingBuffer); | 138 DISALLOW_IMPLICIT_CONSTRUCTORS(RingBuffer); |
| 133 }; | 139 }; |
| 134 | 140 |
| 135 } // namespace gpu | 141 } // namespace gpu |
| 136 | 142 |
| 137 #endif // GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ | 143 #endif // GPU_COMMAND_BUFFER_CLIENT_RING_BUFFER_H_ |
| OLD | NEW |