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

Side by Side Diff: include/core/SkTemplates.h

Issue 52843004: Revert r1784: SK_API on a non-concrete template is strange. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | no next file » | 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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #ifndef SkTemplates_DEFINED 10 #ifndef SkTemplates_DEFINED
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 T* detach() { 362 T* detach() {
363 T* ptr = fPtr; 363 T* ptr = fPtr;
364 fPtr = NULL; 364 fPtr = NULL;
365 return ptr; 365 return ptr;
366 } 366 }
367 367
368 private: 368 private:
369 T* fPtr; 369 T* fPtr;
370 }; 370 };
371 371
372 template <size_t N, typename T> class SK_API SkAutoSTMalloc : SkNoncopyable { 372 template <size_t N, typename T> class SkAutoSTMalloc : SkNoncopyable {
373 public: 373 public:
374 SkAutoSTMalloc() { 374 SkAutoSTMalloc() {
375 fPtr = NULL; 375 fPtr = NULL;
376 } 376 }
377 377
378 SkAutoSTMalloc(size_t count) { 378 SkAutoSTMalloc(size_t count) {
379 if (count > N) { 379 if (count > N) {
380 fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW | SK_M ALLOC_TEMP); 380 fPtr = (T*)sk_malloc_flags(count * sizeof(T), SK_MALLOC_THROW | SK_M ALLOC_TEMP);
381 } else if (count) { 381 } else if (count) {
382 fPtr = fTStorage; 382 fPtr = fTStorage;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 /** 458 /**
459 * Returns void* because this object does not initialize the 459 * Returns void* because this object does not initialize the
460 * memory. Use placement new for types that require a cons. 460 * memory. Use placement new for types that require a cons.
461 */ 461 */
462 void* get() { return fStorage.get(); } 462 void* get() { return fStorage.get(); }
463 private: 463 private:
464 SkAlignedSStorage<sizeof(T)*N> fStorage; 464 SkAlignedSStorage<sizeof(T)*N> fStorage;
465 }; 465 };
466 466
467 #endif 467 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698