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

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

Issue 1734063003: Share animations from compositor to main thread. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make NotifyAnimationTakeover pure virtual Created 4 years, 10 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
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_player.h" 5 #include "cc/animation/animation_player.h"
6 6
7 #include "cc/animation/animation_delegate.h" 7 #include "cc/animation/animation_delegate.h"
8 #include "cc/animation/animation_host.h" 8 #include "cc/animation/animation_host.h"
9 #include "cc/animation/animation_timeline.h" 9 #include "cc/animation/animation_timeline.h"
10 #include "cc/animation/element_animations.h" 10 #include "cc/animation/element_animations.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 153 }
154 } 154 }
155 155
156 void AnimationPlayer::AbortAnimation(int animation_id) { 156 void AnimationPlayer::AbortAnimation(int animation_id) {
157 DCHECK(element_animations_); 157 DCHECK(element_animations_);
158 element_animations_->layer_animation_controller()->AbortAnimation( 158 element_animations_->layer_animation_controller()->AbortAnimation(
159 animation_id); 159 animation_id);
160 SetNeedsCommit(); 160 SetNeedsCommit();
161 } 161 }
162 162
163 void AnimationPlayer::AbortAnimations(TargetProperty::Type target_property) { 163 void AnimationPlayer::AbortAnimations(TargetProperty::Type target_property,
164 bool needs_completion) {
164 if (element_animations_) { 165 if (element_animations_) {
165 element_animations_->layer_animation_controller()->AbortAnimations( 166 element_animations_->layer_animation_controller()->AbortAnimations(
166 target_property); 167 target_property, needs_completion);
167 SetNeedsCommit(); 168 SetNeedsCommit();
168 } else { 169 } else {
169 auto animations_to_remove = std::remove_if( 170 auto animations_to_remove = std::remove_if(
170 animations_.begin(), animations_.end(), 171 animations_.begin(), animations_.end(),
171 [target_property](const scoped_ptr<Animation>& animation) { 172 [target_property](const scoped_ptr<Animation>& animation) {
172 return animation->target_property() == target_property; 173 return animation->target_property() == target_property;
173 }); 174 });
174 animations_.erase(animations_to_remove, animations_.end()); 175 animations_.erase(animations_to_remove, animations_.end());
175 } 176 }
176 } 177 }
(...skipping 27 matching lines...) Expand all
204 205
205 void AnimationPlayer::NotifyAnimationAborted( 206 void AnimationPlayer::NotifyAnimationAborted(
206 base::TimeTicks monotonic_time, 207 base::TimeTicks monotonic_time,
207 TargetProperty::Type target_property, 208 TargetProperty::Type target_property,
208 int group) { 209 int group) {
209 if (layer_animation_delegate_) 210 if (layer_animation_delegate_)
210 layer_animation_delegate_->NotifyAnimationAborted(monotonic_time, 211 layer_animation_delegate_->NotifyAnimationAborted(monotonic_time,
211 target_property, group); 212 target_property, group);
212 } 213 }
213 214
215 void AnimationPlayer::NotifyAnimationTakeover(
216 base::TimeTicks monotonic_time,
217 double animation_start_time,
218 scoped_ptr<AnimationCurve> curve) {
219 if (layer_animation_delegate_) {
220 DCHECK(curve);
221 layer_animation_delegate_->NotifyAnimationTakeover(
222 monotonic_time, animation_start_time, std::move(curve));
223 }
224 }
225
214 void AnimationPlayer::SetNeedsCommit() { 226 void AnimationPlayer::SetNeedsCommit() {
215 DCHECK(animation_host_); 227 DCHECK(animation_host_);
216 animation_host_->SetNeedsCommit(); 228 animation_host_->SetNeedsCommit();
217 animation_host_->SetNeedsRebuildPropertyTrees(); 229 animation_host_->SetNeedsRebuildPropertyTrees();
218 } 230 }
219 231
220 } // namespace cc 232 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698