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

Unified Diff: cc/trees/thread_proxy.cc

Issue 68893031: Unifies LayerTreeHost::SetNeedsUpdateLayers and SetNeedsAnimate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed cc animation unittest Created 7 years 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: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 9624a2dc293bfefdc4c2f50e386a4336addd8c92..c55b8995b50a321e44fd8b91a71c60405d55eb8e 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -80,7 +80,7 @@ ThreadProxy::ThreadProxy(
LayerTreeHost* layer_tree_host,
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner)
: Proxy(impl_task_runner),
- animate_requested_(false),
+ update_requested_(false),
commit_requested_(false),
commit_request_sent_to_impl_thread_(false),
created_offscreen_context_provider_(false),
@@ -350,24 +350,14 @@ const RendererCapabilities& ThreadProxy::GetRendererCapabilities() const {
return renderer_capabilities_main_thread_copy_;
}
-void ThreadProxy::SetNeedsAnimate() {
- DCHECK(IsMainThread());
- if (animate_requested_)
- return;
-
- TRACE_EVENT0("cc", "ThreadProxy::SetNeedsAnimate");
- animate_requested_ = true;
- can_cancel_commit_ = false;
- SendCommitRequestToImplThreadIfNeeded();
-}
-
void ThreadProxy::SetNeedsUpdateLayers() {
DCHECK(IsMainThread());
- if (commit_request_sent_to_impl_thread_)
+ if (update_requested_)
return;
TRACE_EVENT0("cc", "ThreadProxy::SetNeedsUpdateLayers");
+ update_requested_ = true;
SendCommitRequestToImplThreadIfNeeded();
}
@@ -786,10 +776,10 @@ void ThreadProxy::BeginMainFrame(
commit_requested_ = true;
commit_request_sent_to_impl_thread_ = true;
- // On the other hand, the AnimationRequested flag needs to be cleared
- // here so that any animation requests generated by the apply or animate
+ // On the other hand, the update_requested_ flag needs to be cleared
+ // here so that any update requests generated by the apply or animate
// callbacks will trigger another frame.
- animate_requested_ = false;
+ update_requested_ = false;
if (!in_composite_and_readback_ && !layer_tree_host()->visible()) {
commit_requested_ = false;
@@ -865,6 +855,16 @@ void ThreadProxy::BeginMainFrame(
layer_tree_host()->WillCommit();
+ // Before calling animate, we set update_requested_ to false. If it is true
+ // now, it means SetNeedsUpdateLayers was called again, but during a state
+ // when commit_request_sent_to_impl_thread_ = true. We need to force that call
danakj 2013/12/05 18:28:16 Can you explain this? The SetNeedsUpdateLayers() f
ajuma 2013/12/05 19:01:06 SetNeedsUpdateLayers calls SendCommitRequestToImpl
danakj 2013/12/05 19:18:51 Ah, thanks. I see. SendCommitRequestToImplThreadIf
trchen 2013/12/06 03:42:39 It is doing the right thing. The comment is a bit
danakj 2013/12/06 17:21:33 Ah, that will do something different though, as SN
+ // to happen again now so that the commit request is sent to the impl thread.
+ if (update_requested_) {
+ // Forces SetNeedsUpdateLayers to consider posting a commit task.
+ update_requested_ = false;
+ SetNeedsUpdateLayers();
+ }
+
if (!updated && can_cancel_this_commit) {
TRACE_EVENT0("cc", "EarlyOut_NoUpdates");
bool did_handle = true;
@@ -882,16 +882,6 @@ void ThreadProxy::BeginMainFrame(
return;
}
- // Before calling animate, we set animate_requested_ to false. If it is true
- // now, it means SetNeedAnimate was called again, but during a state when
- // commit_request_sent_to_impl_thread_ = true. We need to force that call to
- // happen again now so that the commit request is sent to the impl thread.
- if (animate_requested_) {
- // Forces SetNeedsAnimate to consider posting a commit task.
- animate_requested_ = false;
- SetNeedsAnimate();
- }
-
scoped_refptr<cc::ContextProvider> offscreen_context_provider;
if (renderer_capabilities_main_thread_copy_.using_offscreen_context3d &&
layer_tree_host()->needs_offscreen_context()) {

Powered by Google App Engine
This is Rietveld 408576698