diff options
author | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-12 17:04:58 +0000 |
---|---|---|
committer | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-12 17:04:58 +0000 |
commit | 097a0cbf203baa9e9de663b7afee7734f6f40cc7 (patch) | |
tree | c39b9b2cd2bea2d1218cf21ab7e86d58164649a1 | |
parent | f146e9d973dc48af2a1d2bb615e0fb77e9279e16 (diff) | |
download | chromium_src-097a0cbf203baa9e9de663b7afee7734f6f40cc7.zip chromium_src-097a0cbf203baa9e9de663b7afee7734f6f40cc7.tar.gz chromium_src-097a0cbf203baa9e9de663b7afee7734f6f40cc7.tar.bz2 |
cc: Don't cancel poll_for_draw_triggers_closure_ too early.
Previously, the second poll event would always get canceled before
it has a chance to be run.
Existing tests have been modified to abort multiple commits in a
row. Although these don't fail without this patch, they are only
passing because of distant side-effects that happen to result
in a third poll event being scheduled.
BUG=327859
Review URL: https://codereview.chromium.org/102643009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240336 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | cc/scheduler/scheduler.cc | 3 | ||||
-rw-r--r-- | cc/test/layer_tree_test.cc | 5 | ||||
-rw-r--r-- | cc/test/layer_tree_test.h | 2 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.cc | 10 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_impl.h | 1 | ||||
-rw-r--r-- | cc/trees/layer_tree_host_unittest.cc | 19 | ||||
-rw-r--r-- | cc/trees/thread_proxy.cc | 10 |
7 files changed, 35 insertions, 15 deletions
diff --git a/cc/scheduler/scheduler.cc b/cc/scheduler/scheduler.cc index e33c0a8..7b70dd4 100644 --- a/cc/scheduler/scheduler.cc +++ b/cc/scheduler/scheduler.cc @@ -281,11 +281,10 @@ void Scheduler::OnBeginImplFrameDeadline() { void Scheduler::PollForAnticipatedDrawTriggers() { TRACE_EVENT0("cc", "Scheduler::PollForAnticipatedDrawTriggers"); + poll_for_draw_triggers_closure_.Cancel(); state_machine_.DidEnterPollForAnticipatedDrawTriggers(); ProcessScheduledActions(); state_machine_.DidLeavePollForAnticipatedDrawTriggers(); - - poll_for_draw_triggers_closure_.Cancel(); } void Scheduler::DrawAndSwapIfPossible() { diff --git a/cc/test/layer_tree_test.cc b/cc/test/layer_tree_test.cc index b723c56..64c3e9a 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -84,6 +84,11 @@ class LayerTreeHostImplForTesting : public LayerTreeHostImpl { test_hooks_->DidBeginImplFrameOnThread(this, args); } + virtual void BeginMainFrameAborted(bool did_handle) OVERRIDE { + LayerTreeHostImpl::BeginMainFrameAborted(did_handle); + test_hooks_->BeginMainFrameAbortedOnThread(this, did_handle); + } + virtual void BeginCommit() OVERRIDE { LayerTreeHostImpl::BeginCommit(); test_hooks_->BeginCommitOnThread(this); diff --git a/cc/test/layer_tree_test.h b/cc/test/layer_tree_test.h index dd5a8d5..1e58dd9 100644 --- a/cc/test/layer_tree_test.h +++ b/cc/test/layer_tree_test.h @@ -35,6 +35,8 @@ class TestHooks : public AnimationDelegate { const BeginFrameArgs& args) {} virtual void DidBeginImplFrameOnThread(LayerTreeHostImpl* host_impl, const BeginFrameArgs& args) {} + virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl, + bool did_handle) {} virtual void BeginCommitOnThread(LayerTreeHostImpl* host_impl) {} virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) {} virtual void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) {} diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc index 4bda19a..509d510 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -303,6 +303,16 @@ LayerTreeHostImpl::~LayerTreeHostImpl() { active_tree_.reset(); } +void LayerTreeHostImpl::BeginMainFrameAborted(bool did_handle) { + // If the begin frame data was handled, then scroll and scale set was applied + // by the main thread, so the active tree needs to be updated as if these sent + // values were applied and committed. + if (did_handle) { + active_tree_->ApplySentScrollAndScaleDeltasFromAbortedCommit(); + active_tree_->ResetContentsTexturesPurged(); + } +} + void LayerTreeHostImpl::BeginCommit() {} void LayerTreeHostImpl::CommitComplete() { diff --git a/cc/trees/layer_tree_host_impl.h b/cc/trees/layer_tree_host_impl.h index 8d1230b..531384f 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -161,6 +161,7 @@ class CC_EXPORT LayerTreeHostImpl virtual void AppendRenderPass(scoped_ptr<RenderPass> render_pass) OVERRIDE; }; + virtual void BeginMainFrameAborted(bool did_handle); virtual void BeginCommit(); virtual void CommitComplete(); virtual void Animate(base::TimeTicks monotonic_time, diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc index 2d1357f..0ac203a 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -2646,7 +2646,7 @@ MULTI_THREAD_TEST_F( class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { protected: LayerTreeHostTestAbortedCommitDoesntStall() - : commit_count_(0), commit_complete_count_(0) {} + : commit_count_(0), commit_abort_count_(0), commit_complete_count_(0) {} virtual void InitializeSettings(LayerTreeSettings* settings) OVERRIDE { settings->begin_impl_frame_scheduling_enabled = true; @@ -2656,18 +2656,25 @@ class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { virtual void DidCommit() OVERRIDE { commit_count_++; - if (commit_count_ == 2) { - // A commit was just aborted, request a real commit now to make sure a + if (commit_count_ == 4) { + // After two aborted commits, request a real commit now to make sure a // real commit following an aborted commit will still complete and // end the test even when the Impl thread is idle. layer_tree_host()->SetNeedsCommit(); } } + virtual void BeginMainFrameAbortedOnThread( + LayerTreeHostImpl *host_impl, bool did_handle) OVERRIDE { + commit_abort_count_++; + // Initiate another abortable commit. + host_impl->SetNeedsCommit(); + } + virtual void CommitCompleteOnThread(LayerTreeHostImpl* host_impl) OVERRIDE { commit_complete_count_++; if (commit_complete_count_ == 1) { - // Initiate an aborted commit after the first commit. + // Initiate an abortable commit after the first commit. host_impl->SetNeedsCommit(); } else { EndTest(); @@ -2675,11 +2682,13 @@ class LayerTreeHostTestAbortedCommitDoesntStall : public LayerTreeHostTest { } virtual void AfterTest() OVERRIDE { - EXPECT_EQ(commit_count_, 3); + EXPECT_EQ(commit_count_, 5); + EXPECT_EQ(commit_abort_count_, 3); EXPECT_EQ(commit_complete_count_, 2); } int commit_count_; + int commit_abort_count_; int commit_complete_count_; }; diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc index 6149522..2823182 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -1002,15 +1002,9 @@ void ThreadProxy::BeginMainFrameAbortedOnImplThread(bool did_handle) { DCHECK(scheduler_on_impl_thread_->CommitPending()); DCHECK(!layer_tree_host_impl_->pending_tree()); - // If the begin frame data was handled, then scroll and scale set was applied - // by the main thread, so the active tree needs to be updated as if these sent - // values were applied and committed. - if (did_handle) { - layer_tree_host_impl_->active_tree() - ->ApplySentScrollAndScaleDeltasFromAbortedCommit(); - layer_tree_host_impl_->active_tree()->ResetContentsTexturesPurged(); + if (did_handle) SetInputThrottledUntilCommitOnImplThread(false); - } + layer_tree_host_impl_->BeginMainFrameAborted(did_handle); scheduler_on_impl_thread_->BeginMainFrameAborted(did_handle); } |