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

Side by Side Diff: cc/animation/animation_host.cc

Issue 1734063003: Share animations from compositor to main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win trybot failure Created 4 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 unified diff | Download patch
« no previous file with comments | « cc/animation/animation_host.h ('k') | cc/animation/animation_player.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/animation/animation_host.h" 5 #include "cc/animation/animation_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "cc/animation/animation_delegate.h" 10 #include "cc/animation/animation_delegate.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 new_target.SetToMax(gfx::ScrollOffset()); 91 new_target.SetToMax(gfx::ScrollOffset());
92 new_target.SetToMin(max_scroll_offset); 92 new_target.SetToMin(max_scroll_offset);
93 93
94 curve->UpdateTarget(animation->TrimTimeToCurrentIteration( 94 curve->UpdateTarget(animation->TrimTimeToCurrentIteration(
95 frame_monotonic_time).InSecondsF(), 95 frame_monotonic_time).InSecondsF(),
96 new_target); 96 new_target);
97 97
98 return true; 98 return true;
99 } 99 }
100 100
101 void ScrollAnimationAbort() { 101 void ScrollAnimationAbort(bool needs_completion) {
102 DCHECK(scroll_offset_animation_player_); 102 DCHECK(scroll_offset_animation_player_);
103 scroll_offset_animation_player_->AbortAnimations( 103 scroll_offset_animation_player_->AbortAnimations(
104 TargetProperty::SCROLL_OFFSET); 104 TargetProperty::SCROLL_OFFSET, needs_completion);
105 } 105 }
106 106
107 // AnimationDelegate implementation. 107 // AnimationDelegate implementation.
108 void NotifyAnimationStarted(base::TimeTicks monotonic_time, 108 void NotifyAnimationStarted(base::TimeTicks monotonic_time,
109 TargetProperty::Type target_property, 109 TargetProperty::Type target_property,
110 int group) override {} 110 int group) override {}
111 void NotifyAnimationFinished(base::TimeTicks monotonic_time, 111 void NotifyAnimationFinished(base::TimeTicks monotonic_time,
112 TargetProperty::Type target_property, 112 TargetProperty::Type target_property,
113 int group) override { 113 int group) override {
114 DCHECK_EQ(target_property, TargetProperty::SCROLL_OFFSET); 114 DCHECK_EQ(target_property, TargetProperty::SCROLL_OFFSET);
115 DCHECK(animation_host_->mutator_host_client()); 115 DCHECK(animation_host_->mutator_host_client());
116 animation_host_->mutator_host_client()->ScrollOffsetAnimationFinished(); 116 animation_host_->mutator_host_client()->ScrollOffsetAnimationFinished();
117 } 117 }
118 void NotifyAnimationAborted(base::TimeTicks monotonic_time, 118 void NotifyAnimationAborted(base::TimeTicks monotonic_time,
119 TargetProperty::Type target_property, 119 TargetProperty::Type target_property,
120 int group) override {} 120 int group) override {}
121 void NotifyAnimationTakeover(base::TimeTicks monotonic_time,
122 TargetProperty::Type target_property,
123 double animation_start_time,
124 scoped_ptr<AnimationCurve> curve) override {}
121 125
122 private: 126 private:
123 void ReattachScrollOffsetPlayerIfNeeded(int layer_id) { 127 void ReattachScrollOffsetPlayerIfNeeded(int layer_id) {
124 if (scroll_offset_animation_player_->layer_id() != layer_id) { 128 if (scroll_offset_animation_player_->layer_id() != layer_id) {
125 if (scroll_offset_animation_player_->layer_id()) 129 if (scroll_offset_animation_player_->layer_id())
126 scroll_offset_animation_player_->DetachLayer(); 130 scroll_offset_animation_player_->DetachLayer();
127 if (layer_id) 131 if (layer_id)
128 scroll_offset_animation_player_->AttachLayer(layer_id); 132 scroll_offset_animation_player_->AttachLayer(layer_id);
129 } 133 }
130 } 134 }
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 473
470 bool AnimationHost::OpacityIsAnimatingOnImplOnly(int layer_id) const { 474 bool AnimationHost::OpacityIsAnimatingOnImplOnly(int layer_id) const {
471 LayerAnimationController* controller = GetControllerForLayerId(layer_id); 475 LayerAnimationController* controller = GetControllerForLayerId(layer_id);
472 if (!controller) 476 if (!controller)
473 return false; 477 return false;
474 478
475 Animation* animation = controller->GetAnimation(TargetProperty::OPACITY); 479 Animation* animation = controller->GetAnimation(TargetProperty::OPACITY);
476 return animation && animation->is_impl_only(); 480 return animation && animation->is_impl_only();
477 } 481 }
478 482
483 bool AnimationHost::ScrollOffsetIsAnimatingOnImplOnly(int layer_id) const {
484 LayerAnimationController* controller = GetControllerForLayerId(layer_id);
485 if (!controller)
486 return false;
487
488 Animation* animation =
489 controller->GetAnimation(TargetProperty::SCROLL_OFFSET);
490 return animation && animation->is_impl_only();
491 }
492
479 bool AnimationHost::TransformIsAnimatingOnImplOnly(int layer_id) const { 493 bool AnimationHost::TransformIsAnimatingOnImplOnly(int layer_id) const {
480 LayerAnimationController* controller = GetControllerForLayerId(layer_id); 494 LayerAnimationController* controller = GetControllerForLayerId(layer_id);
481 if (!controller) 495 if (!controller)
482 return false; 496 return false;
483 497
484 Animation* animation = controller->GetAnimation(TargetProperty::TRANSFORM); 498 Animation* animation = controller->GetAnimation(TargetProperty::TRANSFORM);
485 return animation && animation->is_impl_only(); 499 return animation && animation->is_impl_only();
486 } 500 }
487 501
488 bool AnimationHost::HasFilterAnimationThatInflatesBounds(int layer_id) const { 502 bool AnimationHost::HasFilterAnimationThatInflatesBounds(int layer_id) const {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 bool AnimationHost::ImplOnlyScrollAnimationUpdateTarget( 593 bool AnimationHost::ImplOnlyScrollAnimationUpdateTarget(
580 int layer_id, 594 int layer_id,
581 const gfx::Vector2dF& scroll_delta, 595 const gfx::Vector2dF& scroll_delta,
582 const gfx::ScrollOffset& max_scroll_offset, 596 const gfx::ScrollOffset& max_scroll_offset,
583 base::TimeTicks frame_monotonic_time) { 597 base::TimeTicks frame_monotonic_time) {
584 DCHECK(scroll_offset_animations_); 598 DCHECK(scroll_offset_animations_);
585 return scroll_offset_animations_->ScrollAnimationUpdateTarget( 599 return scroll_offset_animations_->ScrollAnimationUpdateTarget(
586 layer_id, scroll_delta, max_scroll_offset, frame_monotonic_time); 600 layer_id, scroll_delta, max_scroll_offset, frame_monotonic_time);
587 } 601 }
588 602
589 void AnimationHost::ScrollAnimationAbort() { 603 void AnimationHost::ScrollAnimationAbort(bool needs_completion) {
590 DCHECK(scroll_offset_animations_); 604 DCHECK(scroll_offset_animations_);
591 return scroll_offset_animations_->ScrollAnimationAbort(); 605 return scroll_offset_animations_->ScrollAnimationAbort(needs_completion);
592 } 606 }
593 607
594 } // namespace cc 608 } // namespace cc
OLDNEW
« no previous file with comments | « cc/animation/animation_host.h ('k') | cc/animation/animation_player.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698