Commit 49e101d2 authored by brianderson's avatar brianderson Committed by Commit bot

Allow cc::STP::SetNeedsAnimate to request another commit from a commit

This makes SingleThreadProxy behave like ThreadProxy.

BUG=481436

Review URL: https://codereview.chromium.org/1113493007

Cr-Commit-Position: refs/heads/master@{#327396}
parent 6ebd2b85
...@@ -102,7 +102,7 @@ class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback ...@@ -102,7 +102,7 @@ class LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback
int num_begin_frames_; int num_begin_frames_;
}; };
MULTI_THREAD_TEST_F( SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback); LayerTreeHostAnimationTestSetNeedsAnimateInsideAnimationCallback);
// Add a layer animation and confirm that // Add a layer animation and confirm that
......
...@@ -47,6 +47,7 @@ SingleThreadProxy::SingleThreadProxy( ...@@ -47,6 +47,7 @@ SingleThreadProxy::SingleThreadProxy(
next_frame_is_newly_committed_frame_(false), next_frame_is_newly_committed_frame_(false),
inside_draw_(false), inside_draw_(false),
defer_commits_(false), defer_commits_(false),
animate_requested_(false),
commit_requested_(false), commit_requested_(false),
inside_synchronous_composite_(false), inside_synchronous_composite_(false),
output_surface_creation_requested_(false), output_surface_creation_requested_(false),
...@@ -178,7 +179,12 @@ void SingleThreadProxy::SetNeedsAnimate() { ...@@ -178,7 +179,12 @@ void SingleThreadProxy::SetNeedsAnimate() {
TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate"); TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate");
DCHECK(Proxy::IsMainThread()); DCHECK(Proxy::IsMainThread());
client_->ScheduleAnimation(); client_->ScheduleAnimation();
SetNeedsCommit(); if (animate_requested_)
return;
animate_requested_ = true;
DebugScopedSetImplThread impl(this);
if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->SetNeedsCommit();
} }
void SingleThreadProxy::SetNeedsUpdateLayers() { void SingleThreadProxy::SetNeedsUpdateLayers() {
...@@ -335,10 +341,10 @@ void SingleThreadProxy::SetNeedsCommit() { ...@@ -335,10 +341,10 @@ void SingleThreadProxy::SetNeedsCommit() {
client_->ScheduleComposite(); client_->ScheduleComposite();
if (commit_requested_) if (commit_requested_)
return; return;
commit_requested_ = true;
DebugScopedSetImplThread impl(this); DebugScopedSetImplThread impl(this);
if (scheduler_on_impl_thread_) if (scheduler_on_impl_thread_)
scheduler_on_impl_thread_->SetNeedsCommit(); scheduler_on_impl_thread_->SetNeedsCommit();
commit_requested_ = true;
} }
void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) {
...@@ -809,6 +815,7 @@ void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { ...@@ -809,6 +815,7 @@ void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() {
void SingleThreadProxy::BeginMainFrame() { void SingleThreadProxy::BeginMainFrame() {
commit_requested_ = false; commit_requested_ = false;
animate_requested_ = false;
if (defer_commits_) { if (defer_commits_) {
TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit",
...@@ -838,6 +845,8 @@ void SingleThreadProxy::BeginMainFrame() { ...@@ -838,6 +845,8 @@ void SingleThreadProxy::BeginMainFrame() {
} }
// Prevent new commits from being requested inside DoBeginMainFrame. // Prevent new commits from being requested inside DoBeginMainFrame.
// Note: We do not want to prevent SetNeedsAnimate from requesting
// a commit here.
commit_requested_ = true; commit_requested_ = true;
const BeginFrameArgs& begin_frame_args = const BeginFrameArgs& begin_frame_args =
......
...@@ -162,6 +162,7 @@ class CC_EXPORT SingleThreadProxy : public Proxy, ...@@ -162,6 +162,7 @@ class CC_EXPORT SingleThreadProxy : public Proxy,
bool inside_draw_; bool inside_draw_;
bool defer_commits_; bool defer_commits_;
bool animate_requested_;
bool commit_requested_; bool commit_requested_;
bool inside_synchronous_composite_; bool inside_synchronous_composite_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment