OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 SkTArray_DEFINED | 8 #ifndef SkTArray_DEFINED |
9 #define SkTArray_DEFINED | 9 #define SkTArray_DEFINED |
10 | 10 |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 // SkASSERT(atIndex >= 0 && atIndex <= array->count()); | 500 // SkASSERT(atIndex >= 0 && atIndex <= array->count()); |
501 SkASSERT(atIndex == array->count()); | 501 SkASSERT(atIndex == array->count()); |
502 return array->push_back_raw(1); | 502 return array->push_back_raw(1); |
503 } | 503 } |
504 | 504 |
505 // Skia doesn't use C++ exceptions but it may be compiled with them enabled. Hav
ing an op delete | 505 // Skia doesn't use C++ exceptions but it may be compiled with them enabled. Hav
ing an op delete |
506 // to match the op new silences warnings about missing op delete when a construc
tor throws an | 506 // to match the op new silences warnings about missing op delete when a construc
tor throws an |
507 // exception. | 507 // exception. |
508 template <typename T, bool MEM_COPY> | 508 template <typename T, bool MEM_COPY> |
509 void operator delete(void*, SkTArray<T, MEM_COPY>* /*array*/, int /*atIndex*/) { | 509 void operator delete(void*, SkTArray<T, MEM_COPY>* /*array*/, int /*atIndex*/) { |
510 SK_CRASH(); | 510 SK_ABORT("Invalid Operation"); |
511 } | 511 } |
512 | 512 |
513 // Constructs a new object as the last element of an SkTArray. | 513 // Constructs a new object as the last element of an SkTArray. |
514 #define SkNEW_APPEND_TO_TARRAY(array_ptr, type_name, args) \ | 514 #define SkNEW_APPEND_TO_TARRAY(array_ptr, type_name, args) \ |
515 (new ((array_ptr), (array_ptr)->count()) type_name args) | 515 (new ((array_ptr), (array_ptr)->count()) type_name args) |
516 | 516 |
517 | 517 |
518 /** | 518 /** |
519 * Subclass of SkTArray that contains a preallocated memory block for the array. | 519 * Subclass of SkTArray that contains a preallocated memory block for the array. |
520 */ | 520 */ |
(...skipping 29 matching lines...) Expand all Loading... |
550 SkSTArray& operator= (const INHERITED& array) { | 550 SkSTArray& operator= (const INHERITED& array) { |
551 INHERITED::operator=(array); | 551 INHERITED::operator=(array); |
552 return *this; | 552 return *this; |
553 } | 553 } |
554 | 554 |
555 private: | 555 private: |
556 SkAlignedSTStorage<N,T> fStorage; | 556 SkAlignedSTStorage<N,T> fStorage; |
557 }; | 557 }; |
558 | 558 |
559 #endif | 559 #endif |
OLD | NEW |