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

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: Fix input handler proxy test build. Created 6 years, 8 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/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1ec6d3357383893432c553f312d4eeba7ee46f06..f9f81cdd1fd99c913037e86f41c0d0d75a471479 100644
--- a/cc/trees/layer_tree_host_impl.cc
+++ b/cc/trees/layer_tree_host_impl.cc
@@ -470,15 +470,11 @@ void LayerTreeHostImpl::StartPageScaleAnimation(
duration.InSecondsF());
}
- SetNeedsRedraw();
+ SetNeedsAnimate();
client_->SetNeedsCommitOnImplThread();
client_->RenewTreePriority();
}
-void LayerTreeHostImpl::ScheduleAnimation() {
- SetNeedsRedraw();
-}
-
bool LayerTreeHostImpl::HaveTouchEventHandlersAt(
const gfx::Point& viewport_point) {
if (!settings_.touch_hit_testing)
@@ -1742,6 +1738,11 @@ void LayerTreeHostImpl::SetVisible(bool visible) {
renderer_->SetVisible(visible);
}
+void LayerTreeHostImpl::SetNeedsAnimate() {
+ NotifySwapPromiseMonitorsOfSetNeedsRedraw();
+ client_->SetNeedsAnimateOnImplThread();
+}
+
void LayerTreeHostImpl::SetNeedsRedraw() {
NotifySwapPromiseMonitorsOfSetNeedsRedraw();
client_->SetNeedsRedrawOnImplThread();
@@ -2053,6 +2054,7 @@ const gfx::Transform& LayerTreeHostImpl::DrawTransform() const {
void LayerTreeHostImpl::DidChangeTopControlsPosition() {
UpdateInnerViewportContainerSize();
SetNeedsRedraw();
+ SetNeedsAnimate();
active_tree_->set_needs_update_draw_properties();
SetFullRootLayerDamage();
}
@@ -2737,6 +2739,8 @@ void LayerTreeHostImpl::AnimatePageScale(base::TimeTicks monotonic_time) {
page_scale_animation_.reset();
client_->SetNeedsCommitOnImplThread();
client_->RenewTreePriority();
+ } else {
+ SetNeedsAnimate();
}
}
@@ -2746,14 +2750,12 @@ void LayerTreeHostImpl::AnimateTopControls(base::TimeTicks time) {
gfx::Vector2dF scroll = top_controls_manager_->Animate(time);
if (active_tree_->TotalScrollOffset().y() == 0.f)
return;
- if (scroll.IsZero()) {
- // This may happen on the first animation step. Force redraw otherwise
- // the animation would stop because of no new frames.
- SetNeedsRedraw();
- } else {
+ if (!scroll.IsZero()) {
ScrollViewportBy(gfx::ScaleVector2d(
scroll, 1.f / active_tree_->total_page_scale_factor()));
+ SetNeedsRedraw();
}
+ SetNeedsAnimate();
}
void LayerTreeHostImpl::AnimateLayers(base::TimeTicks monotonic_time) {
@@ -2775,7 +2777,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) {
@@ -2797,6 +2799,8 @@ void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) {
if (!events->empty()) {
client_->PostAnimationEventsToMainThreadOnImplThread(events.Pass());
}
+
+ SetNeedsAnimate();
}
base::TimeDelta LayerTreeHostImpl::LowFrequencyAnimationInterval() const {
@@ -2870,9 +2874,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)
@@ -2893,10 +2898,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)
« no previous file with comments | « cc/trees/layer_tree_host_impl.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698