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

Side by Side Diff: ui/compositor/layer_animator.cc

Issue 2473483013: [ash-md] Enhanced LayerAnimator to allow animations to be aborted/started in OnLayerAnimationStarte… (Closed)
Patch Set: Addresse review comments. Created 4 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 unified diff | Download patch
« no previous file with comments | « ui/compositor/layer_animation_sequence.cc ('k') | ui/compositor/layer_animator_unittest.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/compositor/layer_animator.h" 5 #include "ui/compositor/layer_animator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 LayerAnimatorCollection* collection = GetLayerAnimatorCollection(); 839 LayerAnimatorCollection* collection = GetLayerAnimatorCollection();
840 if (is_animating() || adding_animations_) 840 if (is_animating() || adding_animations_)
841 start_time = last_step_time_; 841 start_time = last_step_time_;
842 else if (collection && collection->HasActiveAnimators()) 842 else if (collection && collection->HasActiveAnimators())
843 start_time = collection->last_tick_time(); 843 start_time = collection->last_tick_time();
844 else 844 else
845 start_time = base::TimeTicks::Now(); 845 start_time = base::TimeTicks::Now();
846 846
847 if (!sequence->animation_group_id()) 847 if (!sequence->animation_group_id())
848 sequence->set_animation_group_id(cc::AnimationIdProvider::NextGroupId()); 848 sequence->set_animation_group_id(cc::AnimationIdProvider::NextGroupId());
849 if (!sequence->waiting_for_group_start() || 849
850 sequence->IsFirstElementThreaded()) {
851 sequence->set_start_time(start_time);
852 sequence->Start(delegate());
853 }
854 running_animations_.push_back( 850 running_animations_.push_back(
855 RunningAnimation(sequence->AsWeakPtr())); 851 RunningAnimation(sequence->AsWeakPtr()));
856 852
857 // Need to keep a reference to the animation. 853 // Need to keep a reference to the animation.
858 AddToQueueIfNotPresent(sequence); 854 AddToQueueIfNotPresent(sequence);
859 855
856 if (!sequence->waiting_for_group_start() ||
857 sequence->IsFirstElementThreaded()) {
858 sequence->set_start_time(start_time);
859 sequence->Start(delegate());
860 }
861
860 // Ensure that animations get stepped at their start time. 862 // Ensure that animations get stepped at their start time.
861 Step(start_time); 863 Step(start_time);
862 864
863 return true; 865 return true;
864 } 866 }
865 867
866 void LayerAnimator::GetTargetValue( 868 void LayerAnimator::GetTargetValue(
867 LayerAnimationElement::TargetValue* target) const { 869 LayerAnimationElement::TargetValue* target) const {
868 for (AnimationQueue::const_iterator iter = animation_queue_.begin(); 870 for (AnimationQueue::const_iterator iter = animation_queue_.begin();
869 iter != animation_queue_.end(); ++iter) { 871 iter != animation_queue_.end(); ++iter) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 const base::WeakPtr<LayerAnimationSequence>& sequence) 931 const base::WeakPtr<LayerAnimationSequence>& sequence)
930 : sequence_(sequence) { 932 : sequence_(sequence) {
931 } 933 }
932 934
933 LayerAnimator::RunningAnimation::RunningAnimation( 935 LayerAnimator::RunningAnimation::RunningAnimation(
934 const RunningAnimation& other) = default; 936 const RunningAnimation& other) = default;
935 937
936 LayerAnimator::RunningAnimation::~RunningAnimation() { } 938 LayerAnimator::RunningAnimation::~RunningAnimation() { }
937 939
938 } // namespace ui 940 } // namespace ui
OLDNEW
« no previous file with comments | « ui/compositor/layer_animation_sequence.cc ('k') | ui/compositor/layer_animator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698