| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 FencedAllocator class. | 5 // This file contains the definition of the FencedAllocator class. |
| 6 | 6 |
| 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ | 7 #ifndef GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ |
| 8 #define GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ | 8 #define GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ |
| 9 | 9 |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 Container blocks_; | 132 Container blocks_; |
| 133 | 133 |
| 134 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocator); | 134 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocator); |
| 135 }; | 135 }; |
| 136 | 136 |
| 137 // This class functions just like FencedAllocator, but its API uses pointers | 137 // This class functions just like FencedAllocator, but its API uses pointers |
| 138 // instead of offsets. | 138 // instead of offsets. |
| 139 class FencedAllocatorWrapper { | 139 class FencedAllocatorWrapper { |
| 140 public: | 140 public: |
| 141 FencedAllocatorWrapper(unsigned int size, | 141 FencedAllocatorWrapper(unsigned int size, |
| 142 CommandBufferHelper *helper, | 142 CommandBufferHelper* helper, |
| 143 void *base) | 143 void* base) |
| 144 : allocator_(size, helper), | 144 : allocator_(size, helper), |
| 145 base_(base) { } | 145 base_(base) { } |
| 146 | 146 |
| 147 // Allocates a block of memory. If the buffer is out of directly available | 147 // Allocates a block of memory. If the buffer is out of directly available |
| 148 // memory, this function may wait until memory that was freed "pending a | 148 // memory, this function may wait until memory that was freed "pending a |
| 149 // token" can be re-used. | 149 // token" can be re-used. |
| 150 // | 150 // |
| 151 // Parameters: | 151 // Parameters: |
| 152 // size: the size of the memory block to allocate. | 152 // size: the size of the memory block to allocate. |
| 153 // | 153 // |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // Checks for consistency inside the book-keeping structures. Used for | 222 // Checks for consistency inside the book-keeping structures. Used for |
| 223 // testing. | 223 // testing. |
| 224 bool CheckConsistency() { | 224 bool CheckConsistency() { |
| 225 return allocator_.CheckConsistency(); | 225 return allocator_.CheckConsistency(); |
| 226 } | 226 } |
| 227 | 227 |
| 228 FencedAllocator &allocator() { return allocator_; } | 228 FencedAllocator &allocator() { return allocator_; } |
| 229 | 229 |
| 230 private: | 230 private: |
| 231 FencedAllocator allocator_; | 231 FencedAllocator allocator_; |
| 232 void *base_; | 232 void* base_; |
| 233 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocatorWrapper); | 233 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocatorWrapper); |
| 234 }; | 234 }; |
| 235 | 235 |
| 236 } // namespace gpu | 236 } // namespace gpu |
| 237 | 237 |
| 238 #endif // GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ | 238 #endif // GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ |
| OLD | NEW |