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

Side by Side Diff: bench/benchmain.cpp

Issue 150633008: Fix crash in bench when "--mode record" is used (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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 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 "BenchTimer.h" 8 #include "BenchTimer.h"
9 #include "ResultsWriter.h" 9 #include "ResultsWriter.h"
10 #include "SkBenchLogger.h" 10 #include "SkBenchLogger.h"
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 // you've got a computer clocked at several THz or have a br oken benchmark. ;) 596 // you've got a computer clocked at several THz or have a br oken benchmark. ;)
597 // "1B ought to be enough for anybody." 597 // "1B ought to be enough for anybody."
598 logger.logError(SkStringPrintf( 598 logger.logError(SkStringPrintf(
599 "\nCan't get %s %s to converge in %dms (%d loops)", 599 "\nCan't get %s %s to converge in %dms (%d loops)",
600 bench->getName(), config.name, FLAGS_maxMs, loopsPerIte r)); 600 bench->getName(), config.name, FLAGS_maxMs, loopsPerIte r));
601 break; 601 break;
602 } 602 }
603 603
604 if ((benchMode == kRecord_BenchMode || benchMode == kPictureReco rd_BenchMode)) { 604 if ((benchMode == kRecord_BenchMode || benchMode == kPictureReco rd_BenchMode)) {
605 // Clear the recorded commands so that they do not accumulat e. 605 // Clear the recorded commands so that they do not accumulat e.
606 canvas.reset(recordTo.beginRecording(dim.fX, dim.fY, kRecord Flags)); 606 canvas.reset(SkRef(recordTo.beginRecording(dim.fX, dim.fY, k RecordFlags)));
607 } 607 }
608 608
609 timer.start(); 609 timer.start();
610 // Inner loop that allows us to break the run into smaller 610 // Inner loop that allows us to break the run into smaller
611 // chunks (e.g. frames). This is especially useful for the GPU 611 // chunks (e.g. frames). This is especially useful for the GPU
612 // as we can flush and/or swap buffers to keep the GPU from 612 // as we can flush and/or swap buffers to keep the GPU from
613 // queuing up too much work. 613 // queuing up too much work.
614 for (int loopCount = loopsPerIter; loopCount > 0; ) { 614 for (int loopCount = loopsPerIter; loopCount > 0; ) {
615 // Save and restore around each call to draw() to guarantee a pristine canvas. 615 // Save and restore around each call to draw() to guarantee a pristine canvas.
616 SkAutoCanvasRestore saveRestore(canvas, true/*also save*/); 616 SkAutoCanvasRestore saveRestore(canvas, true/*also save*/);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 gContextFactory.destroyContexts(); 717 gContextFactory.destroyContexts();
718 #endif 718 #endif
719 return 0; 719 return 0;
720 } 720 }
721 721
722 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 722 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
723 int main(int argc, char * const argv[]) { 723 int main(int argc, char * const argv[]) {
724 return tool_main(argc, (char**) argv); 724 return tool_main(argc, (char**) argv);
725 } 725 }
726 #endif 726 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698