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

Side by Side Diff: tools/VisualBench/VisualBench.cpp

Issue 1239103002: Fix visual bench memory leak (Closed) Base URL: https://skia.googlesource.com/skia.git@fixvb1
Patch Set: tweaks Created 5 years, 5 months 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
« no previous file with comments | « tools/VisualBench/VisualBench.h ('k') | tools/VisualBench/VisualBenchmarkStream.cpp » ('j') | 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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 8
9 #include "VisualBench.h" 9 #include "VisualBench.h"
10 10
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 stdDevPercent, 156 stdDevPercent,
157 shortName); 157 shortName);
158 } 158 }
159 } 159 }
160 160
161 bool VisualBench::advanceRecordIfNecessary(SkCanvas* canvas) { 161 bool VisualBench::advanceRecordIfNecessary(SkCanvas* canvas) {
162 if (fBenchmark) { 162 if (fBenchmark) {
163 return true; 163 return true;
164 } 164 }
165 165
166 while ((fBenchmark = fBenchmarkStream->next()) && 166 fBenchmark.reset(fBenchmarkStream->next());
167 (SkCommandLineFlags::ShouldSkip(FLAGS_match, fBenchmark->getUniqueNam e()) ||
168 !fBenchmark->isSuitableFor(Benchmark::kGPU_Backend))) {}
169
170 if (!fBenchmark) { 167 if (!fBenchmark) {
171 return false; 168 return false;
172 } 169 }
173 170
174 canvas->clear(0xffffffff); 171 canvas->clear(0xffffffff);
175 fBenchmark->preDraw(); 172 fBenchmark->preDraw();
176 fBenchmark->perCanvasPreDraw(canvas); 173 fBenchmark->perCanvasPreDraw(canvas);
177 fRecords.push_back(); 174 fRecords.push_back();
178 return true; 175 return true;
179 } 176 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 228 }
232 case kTiming_State: { 229 case kTiming_State: {
233 if (fCurrentFrame >= FLAGS_frames) { 230 if (fCurrentFrame >= FLAGS_frames) {
234 fTimer.end(); 231 fTimer.end();
235 fRecords.back().fMeasurements.push_back( 232 fRecords.back().fMeasurements.push_back(
236 fTimer.fWall / (FLAGS_frames * fLoops * fFlushes)); 233 fTimer.fWall / (FLAGS_frames * fLoops * fFlushes));
237 if (fCurrentSample++ >= FLAGS_samples) { 234 if (fCurrentSample++ >= FLAGS_samples) {
238 fState = kPreWarmLoops_State; 235 fState = kPreWarmLoops_State;
239 this->printStats(); 236 this->printStats();
240 fBenchmark->perCanvasPostDraw(canvas); 237 fBenchmark->perCanvasPostDraw(canvas);
241 fBenchmark = NULL; 238 fBenchmark.reset(NULL);
242 fCurrentSample = 0; 239 fCurrentSample = 0;
243 fFlushes = 1; 240 fFlushes = 1;
244 fLoops = 1; 241 fLoops = 1;
245 } else { 242 } else {
246 fState = kPreWarmTiming_State; 243 fState = kPreWarmTiming_State;
247 } 244 }
248 fTimer = WallTimer(); 245 fTimer = WallTimer();
249 this->resetContext(); 246 this->resetContext();
250 fCurrentFrame = 0; 247 fCurrentFrame = 0;
251 } else { 248 } else {
(...skipping 23 matching lines...) Expand all
275 272
276 void application_term() { 273 void application_term() {
277 SkEvent::Term(); 274 SkEvent::Term();
278 SkGraphics::Term(); 275 SkGraphics::Term();
279 } 276 }
280 277
281 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) { 278 SkOSWindow* create_sk_window(void* hwnd, int argc, char** argv) {
282 return new VisualBench(hwnd, argc, argv); 279 return new VisualBench(hwnd, argc, argv);
283 } 280 }
284 281
OLDNEW
« no previous file with comments | « tools/VisualBench/VisualBench.h ('k') | tools/VisualBench/VisualBenchmarkStream.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698