| 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 <ctype.h> | 8 #include <ctype.h> |
| 9 | 9 |
| 10 #include "nanobench.h" | 10 #include "nanobench.h" |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 | 640 |
| 641 Benchmark* next() { | 641 Benchmark* next() { |
| 642 SkAutoTDelete<Benchmark> bench; | 642 SkAutoTDelete<Benchmark> bench; |
| 643 do { | 643 do { |
| 644 bench.reset(this->rawNext()); | 644 bench.reset(this->rawNext()); |
| 645 if (!bench) { | 645 if (!bench) { |
| 646 return nullptr; | 646 return nullptr; |
| 647 } | 647 } |
| 648 } while(SkCommandLineFlags::ShouldSkip(FLAGS_sourceType, fSourceType) || | 648 } while(SkCommandLineFlags::ShouldSkip(FLAGS_sourceType, fSourceType) || |
| 649 SkCommandLineFlags::ShouldSkip(FLAGS_benchType, fBenchType)); | 649 SkCommandLineFlags::ShouldSkip(FLAGS_benchType, fBenchType)); |
| 650 return bench.detach(); | 650 return bench.release(); |
| 651 } | 651 } |
| 652 | 652 |
| 653 Benchmark* rawNext() { | 653 Benchmark* rawNext() { |
| 654 if (fBenches) { | 654 if (fBenches) { |
| 655 Benchmark* bench = fBenches->factory()(nullptr); | 655 Benchmark* bench = fBenches->factory()(nullptr); |
| 656 fBenches = fBenches->next(); | 656 fBenches = fBenches->next(); |
| 657 fSourceType = "bench"; | 657 fSourceType = "bench"; |
| 658 fBenchType = "micro"; | 658 fBenchType = "micro"; |
| 659 return bench; | 659 return bench; |
| 660 } | 660 } |
| 661 | 661 |
| 662 while (fGMs) { | 662 while (fGMs) { |
| 663 SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(nullptr)); | 663 SkAutoTDelete<skiagm::GM> gm(fGMs->factory()(nullptr)); |
| 664 fGMs = fGMs->next(); | 664 fGMs = fGMs->next(); |
| 665 if (gm->runAsBench()) { | 665 if (gm->runAsBench()) { |
| 666 fSourceType = "gm"; | 666 fSourceType = "gm"; |
| 667 fBenchType = "micro"; | 667 fBenchType = "micro"; |
| 668 return new GMBench(gm.detach()); | 668 return new GMBench(gm.release()); |
| 669 } | 669 } |
| 670 } | 670 } |
| 671 | 671 |
| 672 // First add all .skps as RecordingBenches. | 672 // First add all .skps as RecordingBenches. |
| 673 while (fCurrentRecording < fSKPs.count()) { | 673 while (fCurrentRecording < fSKPs.count()) { |
| 674 const SkString& path = fSKPs[fCurrentRecording++]; | 674 const SkString& path = fSKPs[fCurrentRecording++]; |
| 675 SkAutoTUnref<SkPicture> pic; | 675 SkAutoTUnref<SkPicture> pic; |
| 676 if (!ReadPicture(path.c_str(), &pic)) { | 676 if (!ReadPicture(path.c_str(), &pic)) { |
| 677 continue; | 677 continue; |
| 678 } | 678 } |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1286 | 1286 |
| 1287 return 0; | 1287 return 0; |
| 1288 } | 1288 } |
| 1289 | 1289 |
| 1290 #if !defined SK_BUILD_FOR_IOS | 1290 #if !defined SK_BUILD_FOR_IOS |
| 1291 int main(int argc, char** argv) { | 1291 int main(int argc, char** argv) { |
| 1292 SkCommandLineFlags::Parse(argc, argv); | 1292 SkCommandLineFlags::Parse(argc, argv); |
| 1293 return nanobench_main(); | 1293 return nanobench_main(); |
| 1294 } | 1294 } |
| 1295 #endif | 1295 #endif |
| OLD | NEW |