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

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: okay let's call it SetNeedsUpdateLayers Created 7 years, 1 month 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 b25f8c23a16c819caffa216eb4fa67a3f1eaaab5..b4727c030730dd90e139661bc5a6684ae1c5f065 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -62,7 +62,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),
@@ -330,24 +330,12 @@ 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();
}
@@ -738,10 +726,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;
@@ -815,6 +803,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
+ // 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;
@@ -832,16 +830,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