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

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

Issue 2869183002: Initial implementation of WorkletAnimation (Closed)
Patch Set: Rebase Created 3 years, 6 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 element.GetLayoutObject()->GetCompositingState() == 370 element.GetLayoutObject()->GetCompositingState() ==
371 kPaintsIntoOwnBacking; 371 kPaintsIntoOwnBacking;
372 } 372 }
373 373
374 void CompositorAnimations::StartAnimationOnCompositor( 374 void CompositorAnimations::StartAnimationOnCompositor(
375 const Element& element, 375 const Element& element,
376 int group, 376 int group,
377 double start_time, 377 double start_time,
378 double time_offset, 378 double time_offset,
379 const Timing& timing, 379 const Timing& timing,
380 const Animation& animation, 380 const Animation* animation,
381 CompositorAnimationPlayer* compositor_player,
381 const EffectModel& effect, 382 const EffectModel& effect,
382 Vector<int>& started_animation_ids, 383 Vector<int>& started_animation_ids,
383 double animation_playback_rate) { 384 double animation_playback_rate) {
385 DCHECK(compositor_player);
384 DCHECK(started_animation_ids.IsEmpty()); 386 DCHECK(started_animation_ids.IsEmpty());
385 DCHECK(IsCandidateForAnimationOnCompositor(timing, element, &animation, 387 DCHECK(IsCandidateForAnimationOnCompositor(timing, element, animation, effect,
386 effect, animation_playback_rate)); 388 animation_playback_rate));
387 DCHECK(CanStartAnimationOnCompositor(element)); 389 DCHECK(CanStartAnimationOnCompositor(element));
388 390
389 const KeyframeEffectModelBase& keyframe_effect = 391 const KeyframeEffectModelBase& keyframe_effect =
390 ToKeyframeEffectModelBase(effect); 392 ToKeyframeEffectModelBase(effect);
391 393
392 Vector<std::unique_ptr<CompositorAnimation>> animations; 394 Vector<std::unique_ptr<CompositorAnimation>> animations;
393 GetAnimationOnCompositor(timing, group, start_time, time_offset, 395 GetAnimationOnCompositor(timing, group, start_time, time_offset,
394 keyframe_effect, animations, 396 keyframe_effect, animations,
395 animation_playback_rate); 397 animation_playback_rate);
396 DCHECK(!animations.IsEmpty()); 398 DCHECK(!animations.IsEmpty());
397 for (auto& compositor_animation : animations) { 399 for (auto& compositor_animation : animations) {
398 int id = compositor_animation->Id(); 400 int id = compositor_animation->Id();
399 CompositorAnimationPlayer* compositor_player = animation.CompositorPlayer();
400 DCHECK(compositor_player);
401 compositor_player->AddAnimation(std::move(compositor_animation)); 401 compositor_player->AddAnimation(std::move(compositor_animation));
402 started_animation_ids.push_back(id); 402 started_animation_ids.push_back(id);
403 } 403 }
404 DCHECK(!started_animation_ids.IsEmpty()); 404 DCHECK(!started_animation_ids.IsEmpty());
405 } 405 }
406 406
407 void CompositorAnimations::CancelAnimationOnCompositor( 407 void CompositorAnimations::CancelAnimationOnCompositor(
408 const Element& element, 408 const Element& element,
409 const Animation& animation, 409 const Animation& animation,
410 int id) { 410 int id) {
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 animation->SetTimeOffset(compositor_timing.scaled_time_offset); 648 animation->SetTimeOffset(compositor_timing.scaled_time_offset);
649 animation->SetDirection(compositor_timing.direction); 649 animation->SetDirection(compositor_timing.direction);
650 animation->SetPlaybackRate(compositor_timing.playback_rate); 650 animation->SetPlaybackRate(compositor_timing.playback_rate);
651 animation->SetFillMode(compositor_timing.fill_mode); 651 animation->SetFillMode(compositor_timing.fill_mode);
652 animations.push_back(std::move(animation)); 652 animations.push_back(std::move(animation));
653 } 653 }
654 DCHECK(!animations.IsEmpty()); 654 DCHECK(!animations.IsEmpty());
655 } 655 }
656 656
657 } // namespace blink 657 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698