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

Unified Diff: tools/VisualBench/VisualInteractiveModule.cpp

Issue 1386933002: Cleanup timing state machine (Closed) Base URL: https://skia.googlesource.com/skia.git@vb2
Patch Set: rebase 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
« no previous file with comments | « tools/VisualBench/VisualInteractiveModule.h ('k') | tools/VisualBench/VisualLightweightBenchModule.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/VisualBench/VisualInteractiveModule.cpp
diff --git a/tools/VisualBench/VisualInteractiveModule.cpp b/tools/VisualBench/VisualInteractiveModule.cpp
index f41bcaebab2e03cdad83df75516a0684e81f7ebc..d2e5b20fa3b253a8cc419796aec4e2fee55cfc20 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;
}
#include "GrGpu.h"
@@ -104,10 +105,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:
@@ -121,10 +130,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;
}
« no previous file with comments | « tools/VisualBench/VisualInteractiveModule.h ('k') | tools/VisualBench/VisualLightweightBenchModule.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698