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

Side by Side Diff: src/gpu/GrAllocator.h

Issue 1316123003: Style Change: SkNEW->new; SkDELETE->delete (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 2015-08-26 (Wednesday) 15:59:00 EDT Created 5 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
« no previous file with comments | « src/gpu/GrAddPathRenderers_default.cpp ('k') | src/gpu/GrAtlas.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrAllocator_DEFINED 8 #ifndef GrAllocator_DEFINED
9 #define GrAllocator_DEFINED 9 #define GrAllocator_DEFINED
10 10
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 : fAllocator(sizeof(T), itemsPerBlock, NULL) {} 240 : fAllocator(sizeof(T), itemsPerBlock, NULL) {}
241 241
242 /** 242 /**
243 * Adds an item and returns it. 243 * Adds an item and returns it.
244 * 244 *
245 * @return the added item. 245 * @return the added item.
246 */ 246 */
247 T& push_back() { 247 T& push_back() {
248 void* item = fAllocator.push_back(); 248 void* item = fAllocator.push_back();
249 SkASSERT(item); 249 SkASSERT(item);
250 SkNEW_PLACEMENT(item, T); 250 new (item) T;
251 return *(T*)item; 251 return *(T*)item;
252 } 252 }
253 253
254 T& push_back(const T& t) { 254 T& push_back(const T& t) {
255 void* item = fAllocator.push_back(); 255 void* item = fAllocator.push_back();
256 SkASSERT(item); 256 SkASSERT(item);
257 SkNEW_PLACEMENT_ARGS(item, T, (t)); 257 new (item) T(t);
258 return *(T*)item; 258 return *(T*)item;
259 } 259 }
260 260
261 /** 261 /**
262 * Remove the last item, only call if count() != 0 262 * Remove the last item, only call if count() != 0
263 */ 263 */
264 void pop_back() { 264 void pop_back() {
265 this->back().~T(); 265 this->back().~T();
266 fAllocator.pop_back(); 266 fAllocator.pop_back();
267 } 267 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 // to match the op new silences warnings about missing op delete when a construc tor throws an 389 // to match the op new silences warnings about missing op delete when a construc tor throws an
390 // exception. 390 // exception.
391 template <typename T> void operator delete(void*, GrTAllocator<T>*) { 391 template <typename T> void operator delete(void*, GrTAllocator<T>*) {
392 SK_CRASH(); 392 SK_CRASH();
393 } 393 }
394 394
395 #define GrNEW_APPEND_TO_ALLOCATOR(allocator_ptr, type_name, args) \ 395 #define GrNEW_APPEND_TO_ALLOCATOR(allocator_ptr, type_name, args) \
396 new (allocator_ptr) type_name args 396 new (allocator_ptr) type_name args
397 397
398 #endif 398 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAddPathRenderers_default.cpp ('k') | src/gpu/GrAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698