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

Unified Diff: sky/shell/ui/animator.cc

Issue 1230073002: Teach SkyShell.apk to stop posting frames when not visible (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 5 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: sky/shell/ui/animator.cc
diff --git a/sky/shell/ui/animator.cc b/sky/shell/ui/animator.cc
index 7b7fe3caca0fd510bb2ebcac9ef958d782ce4f72..ceca49942c3e904de70f3f9bc19088bbc9a59693 100644
--- a/sky/shell/ui/animator.cc
+++ b/sky/shell/ui/animator.cc
@@ -16,6 +16,7 @@ Animator::Animator(const Engine::Config& config, Engine* engine)
engine_(engine),
engine_requested_frame_(false),
frame_in_progress_(false),
+ paused_(false),
weak_factory_(this) {
}
@@ -37,10 +38,16 @@ void Animator::RequestFrame() {
}
}
-void Animator::CancelFrameRequest() {
+void Animator::Stop() {
+ paused_ = true;
engine_requested_frame_ = false;
}
+void Animator::Start() {
+ paused_ = false;
+ RequestFrame();
+}
+
void Animator::BeginFrame() {
DCHECK(frame_in_progress_);
// There could be a request in the message loop at time of cancel.
@@ -62,6 +69,9 @@ void Animator::BeginFrame() {
void Animator::OnFrameComplete() {
DCHECK(frame_in_progress_);
frame_in_progress_ = false;
+ if (paused_)
+ return;
+
if (engine_requested_frame_) {
frame_in_progress_ = true;
BeginFrame();

Powered by Google App Engine
This is Rietveld 408576698