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

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

Issue 1944623002: CC Animation: Use ElementId to attach CC animation players. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@erasedomids
Patch Set: Let CC clients generate their own ElementIds locally. Created 4 years, 7 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 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 void Animation::createCompositorPlayer() 902 void Animation::createCompositorPlayer()
903 { 903 {
904 if (Platform::current()->isThreadedAnimationEnabled() && !m_compositorPlayer ) { 904 if (Platform::current()->isThreadedAnimationEnabled() && !m_compositorPlayer ) {
905 ASSERT(Platform::current()->compositorSupport()); 905 ASSERT(Platform::current()->compositorSupport());
906 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimati onPlayer()); 906 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimati onPlayer());
907 ASSERT(m_compositorPlayer); 907 ASSERT(m_compositorPlayer);
908 m_compositorPlayer->setAnimationDelegate(this); 908 m_compositorPlayer->setAnimationDelegate(this);
909 attachCompositorTimeline(); 909 attachCompositorTimeline();
910 } 910 }
911 911
912 attachCompositedLayers(); 912 attachCompositorPlayerToElement();
913 } 913 }
914 914
915 void Animation::destroyCompositorPlayer() 915 void Animation::destroyCompositorPlayer()
916 { 916 {
917 detachCompositedLayers(); 917 detachCompositorPlayerFromElement();
918 918
919 if (m_compositorPlayer) { 919 if (m_compositorPlayer) {
920 detachCompositorTimeline(); 920 detachCompositorTimeline();
921 m_compositorPlayer->setAnimationDelegate(nullptr); 921 m_compositorPlayer->setAnimationDelegate(nullptr);
922 m_compositorPlayer.clear(); 922 m_compositorPlayer.clear();
923 } 923 }
924 } 924 }
925 925
926 void Animation::attachCompositorTimeline() 926 void Animation::attachCompositorTimeline()
927 { 927 {
928 if (m_compositorPlayer) { 928 if (m_compositorPlayer) {
929 CompositorAnimationTimeline* timeline = m_timeline ? m_timeline->composi torTimeline() : nullptr; 929 CompositorAnimationTimeline* timeline = m_timeline ? m_timeline->composi torTimeline() : nullptr;
930 if (timeline) 930 if (timeline)
931 timeline->playerAttached(*this); 931 timeline->playerAttached(*this);
932 } 932 }
933 } 933 }
934 934
935 void Animation::detachCompositorTimeline() 935 void Animation::detachCompositorTimeline()
936 { 936 {
937 if (m_compositorPlayer) { 937 if (m_compositorPlayer) {
938 CompositorAnimationTimeline* timeline = m_timeline ? m_timeline->composi torTimeline() : nullptr; 938 CompositorAnimationTimeline* timeline = m_timeline ? m_timeline->composi torTimeline() : nullptr;
939 if (timeline) 939 if (timeline)
940 timeline->playerDestroyed(*this); 940 timeline->playerDestroyed(*this);
941 } 941 }
942 } 942 }
943 943
944 void Animation::attachCompositedLayers() 944 void Animation::attachCompositorPlayerToElement()
945 { 945 {
946 if (!m_compositorPlayer) 946 if (!m_compositorPlayer)
947 return; 947 return;
948 948
949 ASSERT(m_content); 949 ASSERT(m_content);
950 ASSERT(m_content->isKeyframeEffect()); 950 ASSERT(m_content->isKeyframeEffect());
951 951
952 if (toKeyframeEffect(m_content.get())->canAttachCompositedLayers()) 952 if (toKeyframeEffect(m_content.get())->canAttachCompositorPlayerToElement())
953 toKeyframeEffect(m_content.get())->attachCompositedLayers(); 953 toKeyframeEffect(m_content.get())->attachCompositorPlayerToElement();
954 } 954 }
955 955
956 void Animation::detachCompositedLayers() 956 void Animation::detachCompositorPlayerFromElement()
957 { 957 {
958 if (m_compositorPlayer && m_compositorPlayer->isLayerAttached()) 958 if (m_compositorPlayer && m_compositorPlayer->isElementAttached())
959 m_compositorPlayer->detachLayer(); 959 m_compositorPlayer->detachElement();
960 } 960 }
961 961
962 void Animation::notifyAnimationStarted(double monotonicTime, int group) 962 void Animation::notifyAnimationStarted(double monotonicTime, int group)
963 { 963 {
964 timeline()->document()->compositorPendingAnimations().notifyCompositorAnimat ionStarted(monotonicTime, group); 964 timeline()->document()->compositorPendingAnimations().notifyCompositorAnimat ionStarted(monotonicTime, group);
965 } 965 }
966 966
967 Animation::PlayStateUpdateScope::PlayStateUpdateScope(Animation& animation, Timi ngUpdateReason reason, CompositorPendingChange compositorPendingChange) 967 Animation::PlayStateUpdateScope::PlayStateUpdateScope(Animation& animation, Timi ngUpdateReason reason, CompositorPendingChange compositorPendingChange)
968 : m_animation(animation) 968 : m_animation(animation)
969 , m_initialPlayState(m_animation->playStateInternal()) 969 , m_initialPlayState(m_animation->playStateInternal())
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
1085 visitor->trace(m_timeline); 1085 visitor->trace(m_timeline);
1086 visitor->trace(m_pendingFinishedEvent); 1086 visitor->trace(m_pendingFinishedEvent);
1087 visitor->trace(m_pendingCancelledEvent); 1087 visitor->trace(m_pendingCancelledEvent);
1088 visitor->trace(m_finishedPromise); 1088 visitor->trace(m_finishedPromise);
1089 visitor->trace(m_readyPromise); 1089 visitor->trace(m_readyPromise);
1090 EventTargetWithInlineData::trace(visitor); 1090 EventTargetWithInlineData::trace(visitor);
1091 ActiveDOMObject::trace(visitor); 1091 ActiveDOMObject::trace(visitor);
1092 } 1092 }
1093 1093
1094 } // namespace blink 1094 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698