Chromium Code Reviews| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 m_content->animation()->cancel(); | 104 m_content->animation()->cancel(); |
| 105 m_content->animation()->setEffect(0); | 105 m_content->animation()->setEffect(0); |
| 106 } | 106 } |
| 107 m_content->attach(this); | 107 m_content->attach(this); |
| 108 } | 108 } |
| 109 InspectorInstrumentation::didCreateAnimation(m_timeline->document(), m_seque nceNumber); | 109 InspectorInstrumentation::didCreateAnimation(m_timeline->document(), m_seque nceNumber); |
| 110 } | 110 } |
| 111 | 111 |
| 112 Animation::~Animation() | 112 Animation::~Animation() |
| 113 { | 113 { |
| 114 destroyCompositorPlayer(); | 114 destroyCompositorPlayer(); |
|
haraken
2015/12/09 14:02:04
Can we remove this now?
sof
2015/12/09 14:04:33
No, the AnimationTimeline keeps a weak reference t
| |
| 115 } | 115 } |
| 116 | 116 |
| 117 void Animation::dispose() | |
| 118 { | |
| 119 destroyCompositorPlayer(); | |
| 120 // If the AnimationTimeline and its Animation objects are | |
| 121 // finalized by the same GC, we have to eagerly clear out | |
| 122 // this Animation object's compositor player registration. | |
| 123 ASSERT(!m_compositorPlayer); | |
| 124 } | |
| 125 | |
| 117 double Animation::effectEnd() const | 126 double Animation::effectEnd() const |
| 118 { | 127 { |
| 119 return m_content ? m_content->endTimeInternal() : 0; | 128 return m_content ? m_content->endTimeInternal() : 0; |
| 120 } | 129 } |
| 121 | 130 |
| 122 bool Animation::limited(double currentTime) const | 131 bool Animation::limited(double currentTime) const |
| 123 { | 132 { |
| 124 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu rrentTime >= effectEnd()); | 133 return (m_playbackRate < 0 && currentTime <= 0) || (m_playbackRate > 0 && cu rrentTime >= effectEnd()); |
| 125 } | 134 } |
| 126 | 135 |
| (...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 922 attachCompositedLayers(); | 931 attachCompositedLayers(); |
| 923 } | 932 } |
| 924 | 933 |
| 925 void Animation::destroyCompositorPlayer() | 934 void Animation::destroyCompositorPlayer() |
| 926 { | 935 { |
| 927 detachCompositedLayers(); | 936 detachCompositedLayers(); |
| 928 | 937 |
| 929 if (m_compositorPlayer) { | 938 if (m_compositorPlayer) { |
| 930 detachCompositorTimeline(); | 939 detachCompositorTimeline(); |
| 931 m_compositorPlayer->setAnimationDelegate(nullptr); | 940 m_compositorPlayer->setAnimationDelegate(nullptr); |
| 941 m_compositorPlayer.clear(); | |
| 932 } | 942 } |
| 933 m_compositorPlayer.clear(); | |
| 934 } | 943 } |
| 935 | 944 |
| 936 void Animation::attachCompositorTimeline() | 945 void Animation::attachCompositorTimeline() |
| 937 { | 946 { |
| 938 if (m_compositorPlayer) { | 947 if (m_compositorPlayer) { |
| 939 WebCompositorAnimationTimeline* timeline = m_timeline ? m_timeline->comp ositorTimeline() : nullptr; | 948 WebCompositorAnimationTimeline* timeline = m_timeline ? m_timeline->comp ositorTimeline() : nullptr; |
| 940 if (timeline) | 949 if (timeline) |
| 941 timeline->playerAttached(*this); | 950 timeline->playerAttached(*this); |
| 942 } | 951 } |
| 943 } | 952 } |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1087 visitor->trace(m_content); | 1096 visitor->trace(m_content); |
| 1088 visitor->trace(m_timeline); | 1097 visitor->trace(m_timeline); |
| 1089 visitor->trace(m_pendingFinishedEvent); | 1098 visitor->trace(m_pendingFinishedEvent); |
| 1090 visitor->trace(m_finishedPromise); | 1099 visitor->trace(m_finishedPromise); |
| 1091 visitor->trace(m_readyPromise); | 1100 visitor->trace(m_readyPromise); |
| 1092 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito r); | 1101 RefCountedGarbageCollectedEventTargetWithInlineData<Animation>::trace(visito r); |
| 1093 ActiveDOMObject::trace(visitor); | 1102 ActiveDOMObject::trace(visitor); |
| 1094 } | 1103 } |
| 1095 | 1104 |
| 1096 } // namespace | 1105 } // namespace |
| OLD | NEW |