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

Unified Diff: cc/trees/layer_tree_host_impl.cc

Issue 206793003: cc: Split animating and drawing into separate actions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. Created 6 years, 9 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
Index: cc/trees/layer_tree_host_impl.cc
diff --git a/cc/trees/layer_tree_host_impl.cc b/cc/trees/layer_tree_host_impl.cc
index 072e8e7efbf2d6ae30186f8514e2d47b790961b8..8a262262048c04d308e0a394bb36f0aa77f5cb23 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -461,14 +461,12 @@ void LayerTreeHostImpl::StartPageScaleAnimation(
duration.InSecondsF());
}
- SetNeedsRedraw();
+ SetNeedsAnimate();
client_->SetNeedsCommitOnImplThread();
client_->RenewTreePriority();
}
-void LayerTreeHostImpl::ScheduleAnimation() {
- SetNeedsRedraw();
-}
+void LayerTreeHostImpl::ScheduleAnimation() { SetNeedsAnimate(); }
brianderson 2014/04/01 16:05:11 Can we get rid of ScheduleAnimation?
Sami 2014/04/17 15:16:33 Looks like we can, done.
bool LayerTreeHostImpl::HaveTouchEventHandlersAt(
const gfx::Point& viewport_point) {
@@ -1679,6 +1677,10 @@ void LayerTreeHostImpl::SetVisible(bool visible) {
renderer_->SetVisible(visible);
}
+void LayerTreeHostImpl::SetNeedsAnimate() {
+ client_->SetNeedsAnimateOnImplThread();
+}
+
void LayerTreeHostImpl::SetNeedsRedraw() {
NotifySwapPromiseMonitorsOfSetNeedsRedraw();
brianderson 2014/04/01 16:05:11 What does NotifySwapPromiseMonitorsOfSetNeedsRedra
Sami 2014/04/17 15:16:33 As far as I understand it, that call tells the lat
danakj 2014/04/17 15:18:09 It is meant to tell the monitor that we might draw
client_->SetNeedsRedrawOnImplThread();
@@ -2661,6 +2663,8 @@ void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) {
page_scale_animation_.reset();
client_->SetNeedsCommitOnImplThread();
client_->RenewTreePriority();
+ } else {
+ SetNeedsAnimate();
brianderson 2014/04/01 16:05:11 Can you get rid of the SetNeedsRedraw above? In t
Sami 2014/04/17 15:16:33 I think we still need the SetNeedsRedraw here beca
}
}
@@ -2671,9 +2675,9 @@ void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) {
if (active_tree_->TotalScrollOffset().y() == 0.f)
return;
if (scroll.IsZero()) {
- // This may happen on the first animation step. Force redraw otherwise
+ // This may happen on the first animation step. Force animate otherwise
// the animation would stop because of no new frames.
- SetNeedsRedraw();
+ SetNeedsAnimate();
brianderson 2014/04/01 16:05:11 I guess this is the way it already is, but I wonde
Sami 2014/04/17 15:16:33 Good question. I think we should call SetNeedsAnim
} else {
ScrollViewportBy(gfx::ScaleVector2d(
scroll, 1.f / active_tree_->total_page_scale_factor()));
@@ -2699,7 +2703,7 @@ void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time) {
++iter)
(*iter).second->Animate(monotonic_time_for_cc_animations);
- SetNeedsRedraw();
+ SetNeedsAnimate();
}
void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) {
@@ -2809,9 +2813,10 @@ void LayerTreeHostImpl::AnimateScrollbarsRecursive(LayerImpl* layer,
layer->scrollbar_animation_controller();
if (scrollbar_controller && scrollbar_controller->Animate(time)) {
TRACE_EVENT_INSTANT0(
- "cc", "LayerTreeHostImpl::SetNeedsRedraw due to AnimateScrollbars",
+ "cc",
+ "LayerTreeHostImpl::SetNeedsAnimate due to AnimateScrollbars",
TRACE_EVENT_SCOPE_THREAD);
- SetNeedsRedraw();
+ SetNeedsAnimate();
}
for (size_t i = 0; i < layer->children().size(); ++i)
@@ -2832,10 +2837,11 @@ void LayerTreeHostImpl::StartScrollbarAnimationRecursive(LayerImpl* layer,
layer->scrollbar_animation_controller();
if (scrollbar_controller && scrollbar_controller->IsAnimating()) {
base::TimeDelta delay = scrollbar_controller->DelayBeforeStart(time);
- if (delay > base::TimeDelta())
+ if (delay > base::TimeDelta()) {
client_->RequestScrollbarAnimationOnImplThread(delay);
- else if (scrollbar_controller->Animate(time))
- SetNeedsRedraw();
+ } else if (scrollbar_controller->Animate(time)) {
+ SetNeedsAnimate();
+ }
}
for (size_t i = 0; i < layer->children().size(); ++i)

Powered by Google App Engine
This is Rietveld 408576698