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 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "config.h" | 31 #include "config.h" |
32 #include "core/animation/AnimationTimeline.h" | 32 #include "core/animation/AnimationTimeline.h" |
33 | 33 |
34 #include "core/animation/AnimationClock.h" | 34 #include "core/animation/AnimationClock.h" |
35 #include "core/animation/ElementAnimations.h" | 35 #include "core/animation/ElementAnimations.h" |
36 #include "core/dom/Document.h" | 36 #include "core/dom/Document.h" |
37 #include "core/frame/FrameView.h" | 37 #include "core/frame/FrameView.h" |
38 #include "core/loader/DocumentLoader.h" | 38 #include "core/loader/DocumentLoader.h" |
39 #include "core/page/Page.h" | 39 #include "core/page/Page.h" |
| 40 #include "platform/RuntimeEnabledFeatures.h" |
40 #include "platform/TraceEvent.h" | 41 #include "platform/TraceEvent.h" |
| 42 #include "public/platform/Platform.h" |
| 43 #include "public/platform/WebCompositorAnimationTimeline.h" |
| 44 #include "public/platform/WebCompositorSupport.h" |
41 | 45 |
42 namespace blink { | 46 namespace blink { |
43 | 47 |
44 namespace { | 48 namespace { |
45 | 49 |
46 bool compareAnimationPlayers(const RefPtrWillBeMember<blink::AnimationPlayer>& l
eft, const RefPtrWillBeMember<blink::AnimationPlayer>& right) | 50 bool compareAnimationPlayers(const RefPtrWillBeMember<blink::AnimationPlayer>& l
eft, const RefPtrWillBeMember<blink::AnimationPlayer>& right) |
47 { | 51 { |
48 return AnimationPlayer::hasLowerPriority(left.get(), right.get()); | 52 return AnimationPlayer::hasLowerPriority(left.get(), right.get()); |
49 } | 53 } |
50 | 54 |
(...skipping 14 matching lines...) Expand all Loading... |
65 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the
loader | 69 , m_zeroTime(0) // 0 is used by unit tests which cannot initialize from the
loader |
66 , m_zeroTimeInitialized(false) | 70 , m_zeroTimeInitialized(false) |
67 , m_playbackRate(1) | 71 , m_playbackRate(1) |
68 , m_lastCurrentTimeInternal(0) | 72 , m_lastCurrentTimeInternal(0) |
69 { | 73 { |
70 if (!timing) | 74 if (!timing) |
71 m_timing = adoptPtrWillBeNoop(new AnimationTimelineTiming(this)); | 75 m_timing = adoptPtrWillBeNoop(new AnimationTimelineTiming(this)); |
72 else | 76 else |
73 m_timing = timing; | 77 m_timing = timing; |
74 | 78 |
| 79 if (Platform::current()->compositorSupport() && RuntimeEnabledFeatures::comp
ositorAnimationTimelinesEnabled()) |
| 80 m_compositorTimeline = adoptPtr(Platform::current()->compositorSupport()
->createAnimationTimeline()); |
| 81 |
75 ASSERT(document); | 82 ASSERT(document); |
76 } | 83 } |
77 | 84 |
78 AnimationTimeline::~AnimationTimeline() | 85 AnimationTimeline::~AnimationTimeline() |
79 { | 86 { |
80 #if !ENABLE(OILPAN) | 87 #if !ENABLE(OILPAN) |
81 for (const auto& player : m_players) | 88 for (const auto& player : m_players) |
82 player->timelineDestroyed(); | 89 player->timelineDestroyed(); |
83 #endif | 90 #endif |
84 } | 91 } |
85 | 92 |
86 void AnimationTimeline::playerAttached(AnimationPlayer& player) | 93 void AnimationTimeline::playerAttached(AnimationPlayer& player) |
87 { | 94 { |
88 ASSERT(player.timeline() == this); | 95 ASSERT(player.timeline() == this); |
89 ASSERT(!m_players.contains(&player)); | 96 ASSERT(!m_players.contains(&player)); |
90 m_players.add(&player); | 97 m_players.add(&player); |
| 98 |
| 99 if (m_compositorTimeline) |
| 100 m_compositorTimeline->playerAttached(player); |
91 } | 101 } |
92 | 102 |
93 AnimationPlayer* AnimationTimeline::play(AnimationNode* child) | 103 AnimationPlayer* AnimationTimeline::play(AnimationNode* child) |
94 { | 104 { |
95 if (!m_document) | 105 if (!m_document) |
96 return nullptr; | 106 return nullptr; |
97 | 107 |
98 RefPtrWillBeRawPtr<AnimationPlayer> player = AnimationPlayer::create(child,
this); | 108 RefPtrWillBeRawPtr<AnimationPlayer> player = AnimationPlayer::create(child,
this); |
99 ASSERT(m_players.contains(player.get())); | 109 ASSERT(m_players.contains(player.get())); |
100 | 110 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 { | 322 { |
313 #if ENABLE(OILPAN) | 323 #if ENABLE(OILPAN) |
314 visitor->trace(m_document); | 324 visitor->trace(m_document); |
315 visitor->trace(m_timing); | 325 visitor->trace(m_timing); |
316 visitor->trace(m_playersNeedingUpdate); | 326 visitor->trace(m_playersNeedingUpdate); |
317 visitor->trace(m_players); | 327 visitor->trace(m_players); |
318 #endif | 328 #endif |
319 } | 329 } |
320 | 330 |
321 } // namespace | 331 } // namespace |
OLD | NEW |