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

Side by Side Diff: third_party/WebKit/Source/core/animation/CompositorAnimations.cpp

Issue 2869183002: Initial implementation of WorkletAnimation (Closed)
Patch Set: Use CheckCanStartAnimationOnCompositor Created 3 years, 5 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 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
429 attached_animation->CancelAnimationOnCompositor(); 429 attached_animation->CancelAnimationOnCompositor();
430 } 430 }
431 } 431 }
432 432
433 void CompositorAnimations::StartAnimationOnCompositor( 433 void CompositorAnimations::StartAnimationOnCompositor(
434 const Element& element, 434 const Element& element,
435 int group, 435 int group,
436 double start_time, 436 double start_time,
437 double time_offset, 437 double time_offset,
438 const Timing& timing, 438 const Timing& timing,
439 const Animation& animation, 439 const Animation* animation,
440 CompositorAnimationPlayer* compositor_player,
440 const EffectModel& effect, 441 const EffectModel& effect,
441 Vector<int>& started_animation_ids, 442 Vector<int>& started_animation_ids,
442 double animation_playback_rate) { 443 double animation_playback_rate) {
444 DCHECK(compositor_player);
443 DCHECK(started_animation_ids.IsEmpty()); 445 DCHECK(started_animation_ids.IsEmpty());
444 DCHECK(CheckCanStartAnimationOnCompositor(timing, element, &animation, effect, 446 DCHECK(CheckCanStartAnimationOnCompositor(timing, element, animation, effect,
445 animation_playback_rate) 447 animation_playback_rate)
446 .Ok()); 448 .Ok());
447 449
448 const KeyframeEffectModelBase& keyframe_effect = 450 const KeyframeEffectModelBase& keyframe_effect =
449 ToKeyframeEffectModelBase(effect); 451 ToKeyframeEffectModelBase(effect);
450 452
451 Vector<std::unique_ptr<CompositorAnimation>> animations; 453 Vector<std::unique_ptr<CompositorAnimation>> animations;
452 GetAnimationOnCompositor(timing, group, start_time, time_offset, 454 GetAnimationOnCompositor(timing, group, start_time, time_offset,
453 keyframe_effect, animations, 455 keyframe_effect, animations,
454 animation_playback_rate); 456 animation_playback_rate);
455 DCHECK(!animations.IsEmpty()); 457 DCHECK(!animations.IsEmpty());
456 for (auto& compositor_animation : animations) { 458 for (auto& compositor_animation : animations) {
457 int id = compositor_animation->Id(); 459 int id = compositor_animation->Id();
458 CompositorAnimationPlayer* compositor_player = animation.CompositorPlayer();
459 DCHECK(compositor_player);
460 compositor_player->AddAnimation(std::move(compositor_animation)); 460 compositor_player->AddAnimation(std::move(compositor_animation));
461 started_animation_ids.push_back(id); 461 started_animation_ids.push_back(id);
462 } 462 }
463 DCHECK(!started_animation_ids.IsEmpty()); 463 DCHECK(!started_animation_ids.IsEmpty());
464 } 464 }
465 465
466 void CompositorAnimations::CancelAnimationOnCompositor( 466 void CompositorAnimations::CancelAnimationOnCompositor(
467 const Element& element, 467 const Element& element,
468 const Animation& animation, 468 const Animation& animation,
469 int id) { 469 int id) {
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 animation->SetTimeOffset(compositor_timing.scaled_time_offset); 705 animation->SetTimeOffset(compositor_timing.scaled_time_offset);
706 animation->SetDirection(compositor_timing.direction); 706 animation->SetDirection(compositor_timing.direction);
707 animation->SetPlaybackRate(compositor_timing.playback_rate); 707 animation->SetPlaybackRate(compositor_timing.playback_rate);
708 animation->SetFillMode(compositor_timing.fill_mode); 708 animation->SetFillMode(compositor_timing.fill_mode);
709 animations.push_back(std::move(animation)); 709 animations.push_back(std::move(animation));
710 } 710 }
711 DCHECK(!animations.IsEmpty()); 711 DCHECK(!animations.IsEmpty());
712 } 712 }
713 713
714 } // namespace blink 714 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698