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

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

Issue 2762014: Mac: clang build (Closed)
Patch Set: comments Created 10 years, 3 months 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
OLDNEW
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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 // Gets a pointer to a memory block given the base memory and the offset. 205 // Gets a pointer to a memory block given the base memory and the offset.
206 // It translates FencedAllocator::kInvalidOffset to NULL. 206 // It translates FencedAllocator::kInvalidOffset to NULL.
207 void *GetPointer(FencedAllocator::Offset offset) { 207 void *GetPointer(FencedAllocator::Offset offset) {
208 return (offset == FencedAllocator::kInvalidOffset) ? 208 return (offset == FencedAllocator::kInvalidOffset) ?
209 NULL : static_cast<char *>(base_) + offset; 209 NULL : static_cast<char *>(base_) + offset;
210 } 210 }
211 211
212 // Gets the offset to a memory block given the base memory and the address. 212 // Gets the offset to a memory block given the base memory and the address.
213 // It translates NULL to FencedAllocator::kInvalidOffset. 213 // It translates NULL to FencedAllocator::kInvalidOffset.
214 FencedAllocator::Offset GetOffset(void *pointer) { 214 FencedAllocator::Offset GetOffset(void *pointer) {
215 return pointer ? static_cast<char *>(pointer) - static_cast<char *>(base_) : 215 return pointer ?
216 static_cast<FencedAllocator::Offset>(
217 static_cast<char*>(pointer) - static_cast<char*>(base_)) :
216 FencedAllocator::kInvalidOffset; 218 FencedAllocator::kInvalidOffset;
217 } 219 }
218 220
219 // Gets the size of the largest free block that is available without waiting. 221 // Gets the size of the largest free block that is available without waiting.
220 unsigned int GetLargestFreeSize() { 222 unsigned int GetLargestFreeSize() {
221 return allocator_.GetLargestFreeSize(); 223 return allocator_.GetLargestFreeSize();
222 } 224 }
223 225
224 // Gets the size of the largest free block that can be allocated if the 226 // Gets the size of the largest free block that can be allocated if the
225 // caller can wait. 227 // caller can wait.
(...skipping 11 matching lines...) Expand all
237 239
238 private: 240 private:
239 FencedAllocator allocator_; 241 FencedAllocator allocator_;
240 void* base_; 242 void* base_;
241 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocatorWrapper); 243 DISALLOW_IMPLICIT_CONSTRUCTORS(FencedAllocatorWrapper);
242 }; 244 };
243 245
244 } // namespace gpu 246 } // namespace gpu
245 247
246 #endif // GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_ 248 #endif // GPU_COMMAND_BUFFER_CLIENT_FENCED_ALLOCATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698