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 #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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 } | 44 } |
45 | 45 |
46 static A* Create(SkRandom* r); | 46 static A* Create(SkRandom* r); |
47 | 47 |
48 static void SetAllocator(size_t preallocSize, size_t minAllocSize) { | 48 static void SetAllocator(size_t preallocSize, size_t minAllocSize) { |
49 GrMemoryPool* pool = new GrMemoryPool(preallocSize, minAllocSize); | 49 GrMemoryPool* pool = new GrMemoryPool(preallocSize, minAllocSize); |
50 gPool.reset(pool); | 50 gPool.reset(pool); |
51 } | 51 } |
52 | 52 |
53 static void ResetAllocator() { | 53 static void ResetAllocator() { |
54 gPool.reset(NULL); | 54 gPool.reset(nullptr); |
55 } | 55 } |
56 | 56 |
57 private: | 57 private: |
58 static SkAutoTDelete<GrMemoryPool> gPool; | 58 static SkAutoTDelete<GrMemoryPool> gPool; |
59 char fChar; | 59 char fChar; |
60 }; | 60 }; |
61 | 61 |
62 SkAutoTDelete<GrMemoryPool> A::gPool; | 62 SkAutoTDelete<GrMemoryPool> A::gPool; |
63 | 63 |
64 class B : public A { | 64 class B : public A { |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 case 1: | 157 case 1: |
158 return new B; | 158 return new B; |
159 case 2: | 159 case 2: |
160 return new C; | 160 return new C; |
161 case 3: | 161 case 3: |
162 return new D; | 162 return new D; |
163 case 4: | 163 case 4: |
164 return new E; | 164 return new E; |
165 default: | 165 default: |
166 // suppress warning | 166 // suppress warning |
167 return NULL; | 167 return nullptr; |
168 } | 168 } |
169 } | 169 } |
170 | 170 |
171 struct Rec { | 171 struct Rec { |
172 A* fInstance; | 172 A* fInstance; |
173 int fValue; | 173 int fValue; |
174 }; | 174 }; |
175 | 175 |
176 DEF_TEST(GrMemoryPool, reporter) { | 176 DEF_TEST(GrMemoryPool, reporter) { |
177 // prealloc and min alloc sizes for the pool | 177 // prealloc and min alloc sizes for the pool |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 for (int i = 0; i < instanceRecs.count(); ++i) { | 221 for (int i = 0; i < instanceRecs.count(); ++i) { |
222 Rec& rec = instanceRecs[i]; | 222 Rec& rec = instanceRecs[i]; |
223 REPORTER_ASSERT(reporter, rec.fInstance->checkValues(rec.fValue)
); | 223 REPORTER_ASSERT(reporter, rec.fInstance->checkValues(rec.fValue)
); |
224 delete rec.fInstance; | 224 delete rec.fInstance; |
225 } | 225 } |
226 } | 226 } |
227 } | 227 } |
228 } | 228 } |
229 | 229 |
230 #endif | 230 #endif |
OLD | NEW |