OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 #include "Test.h" | 8 #include "Test.h" |
9 // This is a GPU-backend specific test | 9 // This is a GPU-backend specific test |
10 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 12 matching lines...) Expand all Loading... |
23 int C::gInstCnt = 0; | 23 int C::gInstCnt = 0; |
24 } | 24 } |
25 | 25 |
26 static void check_allocator_helper(GrTAllocator<C>* allocator, int cnt, int popC
nt, | 26 static void check_allocator_helper(GrTAllocator<C>* allocator, int cnt, int popC
nt, |
27 skiatest::Reporter* reporter); | 27 skiatest::Reporter* reporter); |
28 | 28 |
29 // Adds cnt items to the allocator, tests the cnts and iterators, pops popCnt it
ems and checks | 29 // Adds cnt items to the allocator, tests the cnts and iterators, pops popCnt it
ems and checks |
30 // again. Finally it resets the allocator and checks again. | 30 // again. Finally it resets the allocator and checks again. |
31 static void check_allocator(GrTAllocator<C>* allocator, int cnt, int popCnt, | 31 static void check_allocator(GrTAllocator<C>* allocator, int cnt, int popCnt, |
32 skiatest::Reporter* reporter) { | 32 skiatest::Reporter* reporter) { |
33 SkASSERT(NULL != allocator); | 33 SkASSERT(allocator); |
34 SkASSERT(allocator->empty()); | 34 SkASSERT(allocator->empty()); |
35 for (int i = 0; i < cnt; ++i) { | 35 for (int i = 0; i < cnt; ++i) { |
36 // Try both variations of push_back(). | 36 // Try both variations of push_back(). |
37 if (i % 1) { | 37 if (i % 1) { |
38 allocator->push_back(C(i)); | 38 allocator->push_back(C(i)); |
39 } else { | 39 } else { |
40 allocator->push_back() = C(i); | 40 allocator->push_back() = C(i); |
41 } | 41 } |
42 } | 42 } |
43 check_allocator_helper(allocator, cnt, popCnt, reporter); | 43 check_allocator_helper(allocator, cnt, popCnt, reporter); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 check_allocator(allocators[i], 1, 1, reporter); | 94 check_allocator(allocators[i], 1, 1, reporter); |
95 check_allocator(allocators[i], 2, 2, reporter); | 95 check_allocator(allocators[i], 2, 2, reporter); |
96 check_allocator(allocators[i], 10, 1, reporter); | 96 check_allocator(allocators[i], 10, 1, reporter); |
97 check_allocator(allocators[i], 10, 5, reporter); | 97 check_allocator(allocators[i], 10, 5, reporter); |
98 check_allocator(allocators[i], 10, 10, reporter); | 98 check_allocator(allocators[i], 10, 10, reporter); |
99 check_allocator(allocators[i], 100, 10, reporter); | 99 check_allocator(allocators[i], 100, 10, reporter); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 #endif | 103 #endif |
OLD | NEW |