Index: trunk/src/cc/trees/thread_proxy.cc |
=================================================================== |
--- trunk/src/cc/trees/thread_proxy.cc (revision 245527) |
+++ trunk/src/cc/trees/thread_proxy.cc (working copy) |
@@ -81,7 +81,7 @@ |
LayerTreeHost* layer_tree_host, |
scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) |
: Proxy(impl_task_runner), |
- update_requested_(false), |
+ animate_requested_(false), |
commit_requested_(false), |
commit_request_sent_to_impl_thread_(false), |
created_offscreen_context_provider_(false), |
@@ -350,14 +350,24 @@ |
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 (update_requested_) |
+ if (commit_request_sent_to_impl_thread_) |
return; |
TRACE_EVENT0("cc", "ThreadProxy::SetNeedsUpdateLayers"); |
- update_requested_ = true; |
SendCommitRequestToImplThreadIfNeeded(); |
} |
@@ -775,10 +785,10 @@ |
commit_requested_ = true; |
commit_request_sent_to_impl_thread_ = true; |
- // On the other hand, the update_requested_ flag needs to be cleared |
- // here so that any update requests generated by the apply or animate |
+ // On the other hand, the AnimationRequested flag needs to be cleared |
+ // here so that any animation requests generated by the apply or animate |
// callbacks will trigger another frame. |
- update_requested_ = false; |
+ animate_requested_ = false; |
if (!in_composite_and_readback_ && !layer_tree_host()->visible()) { |
commit_requested_ = false; |
@@ -841,8 +851,7 @@ |
bool can_cancel_this_commit = |
can_cancel_commit_ && |
!in_composite_and_readback_ && |
- !evicted_ui_resources && |
- !layer_tree_host()->next_commit_forces_redraw(); |
+ !evicted_ui_resources; |
can_cancel_commit_ = true; |
scoped_ptr<ResourceUpdateQueue> queue = |
@@ -856,17 +865,6 @@ |
layer_tree_host()->WillCommit(); |
- // Before calling animate, we set update_requested_ to false. If it is true |
- // now, it means SetNeedsUpdateLayers was called again. Depending on during |
- // which phase of the commit SetNeedsUpdateLayers was called, |
- // commit_request_sent_to_impl_thread_ may be already cleared or not. |
- // We call SetNeedsUpdateLayers here to make sure a commit always gets posted. |
- 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; |
@@ -884,6 +882,16 @@ |
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<ContextProvider> offscreen_context_provider; |
if (renderer_capabilities_main_thread_copy_.using_offscreen_context3d && |
layer_tree_host()->needs_offscreen_context()) { |