OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "SkTypes.h" | 8 #include "SkTypes.h" |
9 | 9 |
10 // This tests a Gr class | 10 // This tests a Gr class |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 enum { | 110 enum { |
111 kMaxObjects = 4 * (1 << 10), | 111 kMaxObjects = 4 * (1 << 10), |
112 }; | 112 }; |
113 SkAutoTDelete<B> objects[kMaxObjects]; | 113 SkAutoTDelete<B> objects[kMaxObjects]; |
114 | 114 |
115 for (int i = 0; i < loops; i++) { | 115 for (int i = 0; i < loops; i++) { |
116 uint32_t idx = r.nextRangeU(0, kMaxObjects-1); | 116 uint32_t idx = r.nextRangeU(0, kMaxObjects-1); |
117 if (nullptr == objects[idx].get()) { | 117 if (nullptr == objects[idx].get()) { |
118 objects[idx].reset(new B); | 118 objects[idx].reset(new B); |
119 } else { | 119 } else { |
120 objects[idx].free(); | 120 objects[idx].reset(); |
121 } | 121 } |
122 } | 122 } |
123 } | 123 } |
124 | 124 |
125 private: | 125 private: |
126 typedef Benchmark INHERITED; | 126 typedef Benchmark INHERITED; |
127 }; | 127 }; |
128 | 128 |
129 struct C { | 129 struct C { |
130 int gStuff[10]; | 130 int gStuff[10]; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 typedef Benchmark INHERITED; | 171 typedef Benchmark INHERITED; |
172 }; | 172 }; |
173 | 173 |
174 /////////////////////////////////////////////////////////////////////////////// | 174 /////////////////////////////////////////////////////////////////////////////// |
175 | 175 |
176 DEF_BENCH( return new GrMemoryPoolBenchStack(); ) | 176 DEF_BENCH( return new GrMemoryPoolBenchStack(); ) |
177 DEF_BENCH( return new GrMemoryPoolBenchRandom(); ) | 177 DEF_BENCH( return new GrMemoryPoolBenchRandom(); ) |
178 DEF_BENCH( return new GrMemoryPoolBenchQueue(); ) | 178 DEF_BENCH( return new GrMemoryPoolBenchQueue(); ) |
179 | 179 |
180 #endif | 180 #endif |
OLD | NEW |