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

Unified Diff: tools/VisualBench/VisualInteractiveModule.cpp

Issue 1386933002: Cleanup timing state machine (Closed) Base URL: https://skia.googlesource.com/skia.git@vb2
Patch Set: tweaks Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: tools/VisualBench/VisualInteractiveModule.cpp
diff --git a/tools/VisualBench/VisualInteractiveModule.cpp b/tools/VisualBench/VisualInteractiveModule.cpp
index 8f020c4ba4de19ae55658c635efbb937d49afcf8..f40db54d0087b31f1a823e667e2b656ddfdf28b7 100755
--- a/tools/VisualBench/VisualInteractiveModule.cpp
+++ b/tools/VisualBench/VisualInteractiveModule.cpp
@@ -27,6 +27,7 @@ VisualInteractiveModule::VisualInteractiveModule(VisualBench* owner)
: fCurrentMeasurement(0)
, fBenchmark(nullptr)
, fAdvance(false)
+ , fHasBeenReset(false)
, fOwner(SkRef(owner)) {
fBenchmarkStream.reset(new VisualBenchmarkStream);
@@ -93,7 +94,7 @@ bool VisualInteractiveModule::advanceRecordIfNecessary(SkCanvas* canvas) {
fOwner->clear(canvas, SK_ColorWHITE, 2);
fBenchmark->delayedSetup();
-
+ fBenchmark->preTimingHooks(canvas);
return true;
}
@@ -103,10 +104,18 @@ void VisualInteractiveModule::draw(SkCanvas* canvas) {
fOwner->closeWindow();
return;
}
+
+ if (fHasBeenReset) {
+ fHasBeenReset = false;
+ fBenchmark->preTimingHooks(canvas);
+ }
+
this->renderFrame(canvas);
- TimingStateMachine::ParentEvents event = fTSM.nextFrame(canvas, fBenchmark);
+ TimingStateMachine::ParentEvents event = fTSM.nextFrame(false);
switch (event) {
case TimingStateMachine::kReset_ParentEvents:
+ fBenchmark->postTimingHooks(canvas);
+ fHasBeenReset = true;
fOwner->reset();
break;
case TimingStateMachine::kTiming_ParentEvents:
@@ -120,10 +129,10 @@ void VisualInteractiveModule::draw(SkCanvas* canvas) {
if (fAdvance) {
fAdvance = false;
fTSM.nextBenchmark(canvas, fBenchmark);
+ fBenchmark->postTimingHooks(canvas);
fBenchmark.reset(nullptr);
fOwner->reset();
- } else {
- fTSM.nextSample();
+ fHasBeenReset = true;
}
break;
}

Powered by Google App Engine
This is Rietveld 408576698