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

Unified Diff: cc/trees/thread_proxy.cc

Issue 133263004: Unifies LayerTreeHost::SetNeedsUpdateLayers and SetNeedsAnimate -- V2 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mojo build Created 6 years, 11 months 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
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | content/renderer/gpu/render_widget_compositor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/thread_proxy.cc
diff --git a/cc/trees/thread_proxy.cc b/cc/trees/thread_proxy.cc
index 931923f225352e5e301785de9794bf0613533298..a33bd7a50b0f0c706a6c990eebaab0d3caa8ecd7 100644
--- a/cc/trees/thread_proxy.cc
+++ b/cc/trees/thread_proxy.cc
@@ -81,7 +81,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();
}
@@ -785,10 +775,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;
@@ -851,7 +841,8 @@ void ThreadProxy::BeginMainFrame(
bool can_cancel_this_commit =
can_cancel_commit_ &&
!in_composite_and_readback_ &&
- !evicted_ui_resources;
+ !evicted_ui_resources &&
+ !layer_tree_host()->next_commit_forces_redraw();
can_cancel_commit_ = true;
scoped_ptr<ResourceUpdateQueue> queue =
@@ -865,6 +856,17 @@ 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. 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;
@@ -882,16 +884,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<ContextProvider> offscreen_context_provider;
if (renderer_capabilities_main_thread_copy_.using_offscreen_context3d &&
layer_tree_host()->needs_offscreen_context()) {
« no previous file with comments | « cc/trees/thread_proxy.h ('k') | content/renderer/gpu/render_widget_compositor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698