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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
43 #include "platform/bindings/ScriptWrappable.h" | 43 #include "platform/bindings/ScriptWrappable.h" |
44 #include "platform/heap/Handle.h" | 44 #include "platform/heap/Handle.h" |
45 #include "platform/wtf/RefPtr.h" | 45 #include "platform/wtf/RefPtr.h" |
46 #include "platform/wtf/Vector.h" | 46 #include "platform/wtf/Vector.h" |
47 | 47 |
48 namespace blink { | 48 namespace blink { |
49 | 49 |
50 class Animation; | 50 class Animation; |
51 class AnimationEffectReadOnly; | 51 class AnimationEffectReadOnly; |
52 class Document; | 52 class Document; |
53 class DocumentTimelineOptions; | |
53 | 54 |
54 // DocumentTimeline is constructed and owned by Document, and tied to its | 55 // DocumentTimeline is constructed and owned by Document, and tied to its |
55 // lifecycle. | 56 // lifecycle. |
56 class CORE_EXPORT DocumentTimeline : public AnimationTimeline { | 57 class CORE_EXPORT DocumentTimeline : public AnimationTimeline { |
57 DEFINE_WRAPPERTYPEINFO(); | 58 DEFINE_WRAPPERTYPEINFO(); |
58 | 59 |
59 public: | 60 public: |
60 class PlatformTiming : public GarbageCollectedFinalized<PlatformTiming> { | 61 class PlatformTiming : public GarbageCollectedFinalized<PlatformTiming> { |
61 public: | 62 public: |
62 // Calls DocumentTimeline's wake() method after duration seconds. | 63 // Calls DocumentTimeline's wake() method after duration seconds. |
63 virtual void WakeAfter(double duration) = 0; | 64 virtual void WakeAfter(double duration) = 0; |
64 virtual void ServiceOnNextFrame() = 0; | 65 virtual void ServiceOnNextFrame() = 0; |
65 virtual ~PlatformTiming() {} | 66 virtual ~PlatformTiming() {} |
66 DEFINE_INLINE_VIRTUAL_TRACE() {} | 67 DEFINE_INLINE_VIRTUAL_TRACE() {} |
67 }; | 68 }; |
68 | 69 |
69 static DocumentTimeline* Create(Document*, PlatformTiming* = nullptr); | 70 static DocumentTimeline* Create(Document*, |
71 double origin_time = 0.0, | |
alancutter (OOO until 2018)
2017/06/29 03:16:18
Let's use origin_time_in_seconds here.
| |
72 PlatformTiming* = nullptr); | |
73 | |
74 // Web Animations API IDL constructor | |
75 static DocumentTimeline* Create(ExecutionContext*, | |
76 const DocumentTimelineOptions&); | |
70 | 77 |
71 virtual ~DocumentTimeline() {} | 78 virtual ~DocumentTimeline() {} |
72 | 79 |
73 bool IsDocumentTimeline() const final { return true; } | 80 bool IsDocumentTimeline() const final { return true; } |
74 | 81 |
75 void ServiceAnimations(TimingUpdateReason); | 82 void ServiceAnimations(TimingUpdateReason); |
76 void ScheduleNextService(); | 83 void ScheduleNextService(); |
77 | 84 |
78 Animation* Play(AnimationEffectReadOnly*); | 85 Animation* Play(AnimationEffectReadOnly*); |
79 HeapVector<Member<Animation>> getAnimations(); | 86 HeapVector<Member<Animation>> getAnimations(); |
(...skipping 25 matching lines...) Expand all Loading... | |
105 CompositorAnimationTimeline* CompositorTimeline() const { | 112 CompositorAnimationTimeline* CompositorTimeline() const { |
106 return compositor_timeline_.get(); | 113 return compositor_timeline_.get(); |
107 } | 114 } |
108 | 115 |
109 Document* GetDocument() { return document_.Get(); } | 116 Document* GetDocument() { return document_.Get(); } |
110 void Wake(); | 117 void Wake(); |
111 void ResetForTesting(); | 118 void ResetForTesting(); |
112 | 119 |
113 DECLARE_VIRTUAL_TRACE(); | 120 DECLARE_VIRTUAL_TRACE(); |
114 | 121 |
115 protected: | 122 private: |
116 DocumentTimeline(Document*, PlatformTiming*); | 123 DocumentTimeline(Document*, double origin_time, PlatformTiming*); |
117 | 124 |
118 private: | |
119 Member<Document> document_; | 125 Member<Document> document_; |
126 double origin_time_; | |
120 double zero_time_; | 127 double zero_time_; |
121 bool zero_time_initialized_; | 128 bool zero_time_initialized_; |
122 unsigned outdated_animation_count_; | 129 unsigned outdated_animation_count_; |
123 // Animations which will be updated on the next frame | 130 // Animations which will be updated on the next frame |
124 // i.e. current, in effect, or had timing changed | 131 // i.e. current, in effect, or had timing changed |
125 HeapHashSet<Member<Animation>> animations_needing_update_; | 132 HeapHashSet<Member<Animation>> animations_needing_update_; |
126 HeapHashSet<WeakMember<Animation>> animations_; | 133 HeapHashSet<WeakMember<Animation>> animations_; |
127 | 134 |
128 double playback_rate_; | 135 double playback_rate_; |
129 | 136 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 | 170 |
164 DEFINE_TYPE_CASTS(DocumentTimeline, | 171 DEFINE_TYPE_CASTS(DocumentTimeline, |
165 AnimationTimeline, | 172 AnimationTimeline, |
166 timeline, | 173 timeline, |
167 timeline->IsDocumentTimeline(), | 174 timeline->IsDocumentTimeline(), |
168 timeline.IsDocumentTimeline()); | 175 timeline.IsDocumentTimeline()); |
169 | 176 |
170 } // namespace blink | 177 } // namespace blink |
171 | 178 |
172 #endif | 179 #endif |
OLD | NEW |