Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: gpu/command_buffer/client/fenced_allocator.h

Issue 11419280: Make FencedAlloctor fail on size = 0. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add separate zero allocation tracking Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 // NOTE: this will invalidate block indices. 125 // NOTE: this will invalidate block indices.
126 BlockIndex WaitForTokenAndFreeBlock(BlockIndex index); 126 BlockIndex WaitForTokenAndFreeBlock(BlockIndex index);
127 127
128 // Allocates a block of memory inside a given block, splitting it in two 128 // Allocates a block of memory inside a given block, splitting it in two
129 // (unless that block is of the exact requested size). 129 // (unless that block is of the exact requested size).
130 // NOTE: this will invalidate block indices. 130 // NOTE: this will invalidate block indices.
131 // Returns the offset of the allocated block (NOTE: this is different from 131 // Returns the offset of the allocated block (NOTE: this is different from
132 // the other functions that return a block index). 132 // the other functions that return a block index).
133 Offset AllocInBlock(BlockIndex index, unsigned int size); 133 Offset AllocInBlock(BlockIndex index, unsigned int size);
134 134
135 // Frees allocations of size = 0.
136 void FreeZeroAlloc(FencedAllocator::Offset offset);
137
135 CommandBufferHelper *helper_; 138 CommandBufferHelper *helper_;
136 Container blocks_; 139 Container blocks_;
140 Offset zero_offset_;
141 std::vector<bool> zero_allocs_;
137 142
138 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocator); 143 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocator);
139 }; 144 };
140 145
141 // This class functions just like FencedAllocator, but its API uses pointers 146 // This class functions just like FencedAllocator, but its API uses pointers
142 // instead of offsets. 147 // instead of offsets.
143 class FencedAllocatorWrapper { 148 class FencedAllocatorWrapper {
144 public: 149 public:
145 FencedAllocatorWrapper(unsigned int size, 150 FencedAllocatorWrapper(unsigned int size,
146 CommandBufferHelper* helper, 151 CommandBufferHelper* helper,
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 250
246 private: 251 private:
247 FencedAllocator allocator_; 252 FencedAllocator allocator_;
248 void* base_; 253 void* base_;
249 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocatorWrapper); 254 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocatorWrapper);
250 }; 255 };
251 256
252 } // namespace gpu 257 } // namespace gpu
253 258
254 #endif // GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ 259 #endif // GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_
OLDNEW
« no previous file with comments | « no previous file | gpu/command_buffer/client/fenced_allocator.cc » ('j') | gpu/command_buffer/client/fenced_allocator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698