OLD | NEW |
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 22 matching lines...) Expand all Loading... |
33 #include "core/animation/AnimationTimeline.h" | 33 #include "core/animation/AnimationTimeline.h" |
34 #include "core/animation/KeyframeEffect.h" | 34 #include "core/animation/KeyframeEffect.h" |
35 #include "core/dom/Document.h" | 35 #include "core/dom/Document.h" |
36 #include "core/dom/ExceptionCode.h" | 36 #include "core/dom/ExceptionCode.h" |
37 #include "core/events/AnimationPlayerEvent.h" | 37 #include "core/events/AnimationPlayerEvent.h" |
38 #include "core/frame/UseCounter.h" | 38 #include "core/frame/UseCounter.h" |
39 #include "core/inspector/InspectorInstrumentation.h" | 39 #include "core/inspector/InspectorInstrumentation.h" |
40 #include "core/inspector/InspectorTraceEvents.h" | 40 #include "core/inspector/InspectorTraceEvents.h" |
41 #include "platform/RuntimeEnabledFeatures.h" | 41 #include "platform/RuntimeEnabledFeatures.h" |
42 #include "platform/TraceEvent.h" | 42 #include "platform/TraceEvent.h" |
| 43 #include "platform/animation/CompositorAnimationPlayer.h" |
| 44 #include "platform/graphics/CompositorFactory.h" |
43 #include "public/platform/Platform.h" | 45 #include "public/platform/Platform.h" |
44 #include "public/platform/WebCompositorAnimationPlayer.h" | |
45 #include "public/platform/WebCompositorSupport.h" | 46 #include "public/platform/WebCompositorSupport.h" |
46 #include "wtf/MathExtras.h" | 47 #include "wtf/MathExtras.h" |
47 | 48 |
48 namespace blink { | 49 namespace blink { |
49 | 50 |
50 namespace { | 51 namespace { |
51 | 52 |
52 static unsigned nextSequenceNumber() | 53 static unsigned nextSequenceNumber() |
53 { | 54 { |
54 static unsigned next = 0; | 55 static unsigned next = 0; |
(...skipping 859 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
914 void Animation::endUpdatingState() | 915 void Animation::endUpdatingState() |
915 { | 916 { |
916 ASSERT(m_stateIsBeingUpdated); | 917 ASSERT(m_stateIsBeingUpdated); |
917 m_stateIsBeingUpdated = false; | 918 m_stateIsBeingUpdated = false; |
918 } | 919 } |
919 | 920 |
920 void Animation::createCompositorPlayer() | 921 void Animation::createCompositorPlayer() |
921 { | 922 { |
922 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor
m::current()->isThreadedAnimationEnabled() && !m_compositorPlayer) { | 923 if (RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() && Platfor
m::current()->isThreadedAnimationEnabled() && !m_compositorPlayer) { |
923 ASSERT(Platform::current()->compositorSupport()); | 924 ASSERT(Platform::current()->compositorSupport()); |
924 m_compositorPlayer = adoptPtr(Platform::current()->compositorSupport()->
createAnimationPlayer()); | 925 m_compositorPlayer = adoptPtr(CompositorFactory::current().createAnimati
onPlayer()); |
925 ASSERT(m_compositorPlayer); | 926 ASSERT(m_compositorPlayer); |
926 m_compositorPlayer->setAnimationDelegate(this); | 927 m_compositorPlayer->setAnimationDelegate(this); |
927 attachCompositorTimeline(); | 928 attachCompositorTimeline(); |
928 } | 929 } |
929 | 930 |
930 attachCompositedLayers(); | 931 attachCompositedLayers(); |
931 } | 932 } |
932 | 933 |
933 void Animation::destroyCompositorPlayer() | 934 void Animation::destroyCompositorPlayer() |
934 { | 935 { |
935 detachCompositedLayers(); | 936 detachCompositedLayers(); |
936 | 937 |
937 if (m_compositorPlayer) { | 938 if (m_compositorPlayer) { |
938 detachCompositorTimeline(); | 939 detachCompositorTimeline(); |
939 m_compositorPlayer->setAnimationDelegate(nullptr); | 940 m_compositorPlayer->setAnimationDelegate(nullptr); |
940 m_compositorPlayer.clear(); | 941 m_compositorPlayer.clear(); |
941 } | 942 } |
942 } | 943 } |
943 | 944 |
944 void Animation::attachCompositorTimeline() | 945 void Animation::attachCompositorTimeline() |
945 { | 946 { |
946 if (m_compositorPlayer) { | 947 if (m_compositorPlayer) { |
947 WebCompositorAnimationTimeline* timeline = m_timeline ? m_timeline->comp
ositorTimeline() : nullptr; | 948 CompositorAnimationTimeline* timeline = m_timeline ? m_timeline->composi
torTimeline() : nullptr; |
948 if (timeline) | 949 if (timeline) |
949 timeline->playerAttached(*this); | 950 timeline->playerAttached(*this); |
950 } | 951 } |
951 } | 952 } |
952 | 953 |
953 void Animation::detachCompositorTimeline() | 954 void Animation::detachCompositorTimeline() |
954 { | 955 { |
955 if (m_compositorPlayer) { | 956 if (m_compositorPlayer) { |
956 WebCompositorAnimationTimeline* timeline = m_timeline ? m_timeline->comp
ositorTimeline() : nullptr; | 957 CompositorAnimationTimeline* timeline = m_timeline ? m_timeline->composi
torTimeline() : nullptr; |
957 if (timeline) | 958 if (timeline) |
958 timeline->playerDestroyed(*this); | 959 timeline->playerDestroyed(*this); |
959 } | 960 } |
960 } | 961 } |
961 | 962 |
962 void Animation::attachCompositedLayers() | 963 void Animation::attachCompositedLayers() |
963 { | 964 { |
964 if (!RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() || !m_com
positorPlayer) | 965 if (!RuntimeEnabledFeatures::compositorAnimationTimelinesEnabled() || !m_com
positorPlayer) |
965 return; | 966 return; |
966 | 967 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1095 visitor->trace(m_content); | 1096 visitor->trace(m_content); |
1096 visitor->trace(m_timeline); | 1097 visitor->trace(m_timeline); |
1097 visitor->trace(m_pendingFinishedEvent); | 1098 visitor->trace(m_pendingFinishedEvent); |
1098 visitor->trace(m_finishedPromise); | 1099 visitor->trace(m_finishedPromise); |
1099 visitor->trace(m_readyPromise); | 1100 visitor->trace(m_readyPromise); |
1100 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito
r); | 1101 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito
r); |
1101 ActiveDOMObject::trace(visitor); | 1102 ActiveDOMObject::trace(visitor); |
1102 } | 1103 } |
1103 | 1104 |
1104 } // namespace blink | 1105 } // namespace blink |
OLD | NEW |