Index: tools/VisualBench/VisualBenchmarkStream.cpp |
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp |
index c520eeed05510f6197152a4844f8d2cc1f72d81a..235200a761295a69e9e8f84478eba33a5941e25f 100644 |
--- a/tools/VisualBench/VisualBenchmarkStream.cpp |
+++ b/tools/VisualBench/VisualBenchmarkStream.cpp |
@@ -74,6 +74,11 @@ VisualBenchmarkStream::VisualBenchmarkStream() |
} |
} |
} |
+ |
+ // seed with an initial benchmark |
+ // NOTE the initial benchmark will not have preTimingHooks called, but that is okay because |
+ // it is the warmupbench |
+ this->next(); |
} |
bool VisualBenchmarkStream::ReadPicture(const char* path, SkAutoTUnref<SkPicture>* pic) { |
@@ -98,23 +103,24 @@ bool VisualBenchmarkStream::ReadPicture(const char* path, SkAutoTUnref<SkPicture |
} |
Benchmark* VisualBenchmarkStream::next() { |
+ Benchmark* bench; |
if (!fIsWarmedUp) { |
fIsWarmedUp = true; |
- return new WarmupBench; |
- } |
- |
- Benchmark* bench; |
- |
- // skips non matching benches |
- while ((bench = this->innerNext()) && |
- (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()) || |
- !bench->isSuitableFor(Benchmark::kGPU_Backend))) { |
- bench->unref(); |
+ bench = new WarmupBench; |
+ } else { |
+ // skips non matching benches |
+ while ((bench = this->innerNext()) && |
+ (SkCommandLineFlags::ShouldSkip(FLAGS_match, bench->getUniqueName()) || |
+ !bench->isSuitableFor(Benchmark::kGPU_Backend))) { |
+ bench->unref(); |
+ } |
} |
- if (FLAGS_cpu) { |
- return new CpuWrappedBenchmark(bench); |
+ if (bench && FLAGS_cpu) { |
+ bench = new CpuWrappedBenchmark(bench); |
} |
- return bench; |
+ |
+ fBenchmark.reset(bench); |
+ return fBenchmark; |
} |
Benchmark* VisualBenchmarkStream::innerNext() { |