small tidy of benchmarkstream
BUG=skia:
Review URL: https://codereview.chromium.org/1395703002
diff --git a/tools/VisualBench/VisualBenchmarkStream.cpp b/tools/VisualBench/VisualBenchmarkStream.cpp
index c520eee..49bafbf 100644
--- a/tools/VisualBench/VisualBenchmarkStream.cpp
+++ b/tools/VisualBench/VisualBenchmarkStream.cpp
@@ -74,6 +74,9 @@
}
}
}
+
+ // seed with an initial benchmark
+ this->next();
}
bool VisualBenchmarkStream::ReadPicture(const char* path, SkAutoTUnref<SkPicture>* pic) {
@@ -98,23 +101,24 @@
}
Benchmark* VisualBenchmarkStream::next() {
+ Benchmark* bench;
if (!fIsWarmedUp) {
fIsWarmedUp = true;
- return new WarmupBench;
+ 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 (bench && FLAGS_cpu) {
+ bench = new CpuWrappedBenchmark(bench);
}
- Benchmark* bench;
-
- // 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);
- }
- return bench;
+ fBenchmark.reset(bench);
+ return fBenchmark;
}
Benchmark* VisualBenchmarkStream::innerNext() {