| 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 } | 62 } |
| 63 | 63 |
| 64 AnimationTimeline::~AnimationTimeline() | 64 AnimationTimeline::~AnimationTimeline() |
| 65 { | 65 { |
| 66 #if !ENABLE(OILPAN) | 66 #if !ENABLE(OILPAN) |
| 67 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<AnimationPlayer> >::iterator i
t = m_players.begin(); it != m_players.end(); ++it) | 67 for (WillBeHeapHashSet<RawPtrWillBeWeakMember<AnimationPlayer> >::iterator i
t = m_players.begin(); it != m_players.end(); ++it) |
| 68 (*it)->timelineDestroyed(); | 68 (*it)->timelineDestroyed(); |
| 69 #endif | 69 #endif |
| 70 } | 70 } |
| 71 | 71 |
| 72 AnimationPlayer* AnimationTimeline::createAnimationPlayer(TimedItem* child) | 72 AnimationPlayer* AnimationTimeline::createAnimationPlayer(AnimationSource* child
) |
| 73 { | 73 { |
| 74 RefPtrWillBeRawPtr<AnimationPlayer> player = AnimationPlayer::create(*this,
child); | 74 RefPtrWillBeRawPtr<AnimationPlayer> player = AnimationPlayer::create(*this,
child); |
| 75 AnimationPlayer* result = player.get(); | 75 AnimationPlayer* result = player.get(); |
| 76 m_players.add(result); | 76 m_players.add(result); |
| 77 setOutdatedAnimationPlayer(result); | 77 setOutdatedAnimationPlayer(result); |
| 78 return result; | 78 return result; |
| 79 } | 79 } |
| 80 | 80 |
| 81 AnimationPlayer* AnimationTimeline::play(TimedItem* child) | 81 AnimationPlayer* AnimationTimeline::play(AnimationSource* child) |
| 82 { | 82 { |
| 83 if (!m_document) | 83 if (!m_document) |
| 84 return 0; | 84 return 0; |
| 85 AnimationPlayer* player = createAnimationPlayer(child); | 85 AnimationPlayer* player = createAnimationPlayer(child); |
| 86 player->setStartTimeInternal(effectiveTime()); | 86 player->setStartTimeInternal(effectiveTime()); |
| 87 m_document->compositorPendingAnimations().add(player); | 87 m_document->compositorPendingAnimations().add(player); |
| 88 return player; | 88 return player; |
| 89 } | 89 } |
| 90 | 90 |
| 91 void AnimationTimeline::wake() | 91 void AnimationTimeline::wake() |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 if (m_document && m_document->page() && !m_document->page()->animator().isSe
rvicingAnimations()) | 200 if (m_document && m_document->page() && !m_document->page()->animator().isSe
rvicingAnimations()) |
| 201 m_timing->serviceOnNextFrame(); | 201 m_timing->serviceOnNextFrame(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 size_t AnimationTimeline::numberOfActiveAnimationsForTesting() const | 204 size_t AnimationTimeline::numberOfActiveAnimationsForTesting() const |
| 205 { | 205 { |
| 206 // Includes all players whose directly associated timed items | 206 // Includes all players whose directly associated timed items |
| 207 // are current or in effect. | 207 // are current or in effect. |
| 208 size_t count = 0; | 208 size_t count = 0; |
| 209 for (WillBeHeapHashSet<RefPtrWillBeMember<AnimationPlayer> >::iterator it =
m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it) { | 209 for (WillBeHeapHashSet<RefPtrWillBeMember<AnimationPlayer> >::iterator it =
m_playersNeedingUpdate.begin(); it != m_playersNeedingUpdate.end(); ++it) { |
| 210 const TimedItem* timedItem = (*it)->source(); | 210 const AnimationSource* animationSource = (*it)->source(); |
| 211 if ((*it)->hasStartTime()) | 211 if ((*it)->hasStartTime()) |
| 212 count += (timedItem && (timedItem->isCurrent() || timedItem->isInEff
ect())); | 212 count += (animationSource && (animationSource->isCurrent() || animat
ionSource->isInEffect())); |
| 213 } | 213 } |
| 214 return count; | 214 return count; |
| 215 } | 215 } |
| 216 | 216 |
| 217 #if !ENABLE(OILPAN) | 217 #if !ENABLE(OILPAN) |
| 218 void AnimationTimeline::detachFromDocument() | 218 void AnimationTimeline::detachFromDocument() |
| 219 { | 219 { |
| 220 // FIXME: AnimationTimeline should keep Document alive. | 220 // FIXME: AnimationTimeline should keep Document alive. |
| 221 m_document = nullptr; | 221 m_document = nullptr; |
| 222 } | 222 } |
| 223 #endif | 223 #endif |
| 224 | 224 |
| 225 void AnimationTimeline::trace(Visitor* visitor) | 225 void AnimationTimeline::trace(Visitor* visitor) |
| 226 { | 226 { |
| 227 visitor->trace(m_document); | 227 visitor->trace(m_document); |
| 228 visitor->trace(m_timing); | 228 visitor->trace(m_timing); |
| 229 visitor->trace(m_playersNeedingUpdate); | 229 visitor->trace(m_playersNeedingUpdate); |
| 230 visitor->trace(m_players); | 230 visitor->trace(m_players); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace | 233 } // namespace |
| OLD | NEW |