diff options
author | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-16 20:36:30 +0000 |
---|---|---|
committer | brianderson@chromium.org <brianderson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-16 20:36:30 +0000 |
commit | 279b95902147ab525ac79f0dc4d4f46639ccb0f0 (patch) | |
tree | cd628e46ffd72b71ccd30369d7419aa23c73130c | |
parent | 8c4718cc32fbc5893dc496bcc35ebc79ab79ff7e (diff) | |
download | chromium_src-279b95902147ab525ac79f0dc4d4f46639ccb0f0.zip chromium_src-279b95902147ab525ac79f0dc4d4f46639ccb0f0.tar.gz chromium_src-279b95902147ab525ac79f0dc4d4f46639ccb0f0.tar.bz2 |
Merge 240336 "cc: Don't cancel poll_for_draw_triggers_closure_ t..."
> 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
TBR=brianderson@chromium.org
Review URL: https://codereview.chromium.org/102413009
git-svn-id: svn://svn.chromium.org/chrome/branches/1700/src@241012 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 7c57a4c..6a7d1d6 100644 --- a/cc/scheduler/scheduler.cc +++ b/cc/scheduler/scheduler.cc @@ -267,11 +267,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 79b3445..96f300f 100644 --- a/cc/test/layer_tree_test.cc +++ b/cc/test/layer_tree_test.cc @@ -81,6 +81,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 aa55837..38edde9 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 4716ad5..1e0a86c 100644 --- a/cc/trees/layer_tree_host_impl.cc +++ b/cc/trees/layer_tree_host_impl.cc @@ -270,6 +270,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 83b92c8..557c07c 100644 --- a/cc/trees/layer_tree_host_impl.h +++ b/cc/trees/layer_tree_host_impl.h @@ -155,6 +155,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 0b2598b..04ad879 100644 --- a/cc/trees/layer_tree_host_unittest.cc +++ b/cc/trees/layer_tree_host_unittest.cc @@ -2645,7 +2645,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; @@ -2655,18 +2655,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(); @@ -2674,11 +2681,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 4f2f488..2e263f5 100644 --- a/cc/trees/thread_proxy.cc +++ b/cc/trees/thread_proxy.cc @@ -942,15 +942,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); } |