OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 12 matching lines...) Expand all Loading... | |
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #ifndef TextTrack_h | 27 #ifndef TextTrack_h |
28 #define TextTrack_h | 28 #define TextTrack_h |
29 | 29 |
30 #include "bindings/v8/ScriptWrappable.h" | 30 #include "bindings/v8/ScriptWrappable.h" |
31 #include "core/events/EventTarget.h" | 31 #include "core/events/EventTarget.h" |
32 #include "core/html/track/TrackBase.h" | 32 #include "core/html/track/TrackBase.h" |
33 #include "platform/heap/Handle.h" | |
33 #include "wtf/text/WTFString.h" | 34 #include "wtf/text/WTFString.h" |
34 | 35 |
35 namespace WebCore { | 36 namespace WebCore { |
36 | 37 |
37 class Document; | 38 class Document; |
38 class ExceptionState; | 39 class ExceptionState; |
39 class HTMLMediaElement; | 40 class HTMLMediaElement; |
40 class TextTrack; | 41 class TextTrack; |
41 class TextTrackCue; | 42 class TextTrackCue; |
42 class TextTrackCueList; | 43 class TextTrackCueList; |
43 class TextTrackList; | 44 class TextTrackList; |
44 class VTTRegion; | 45 class VTTRegion; |
45 class VTTRegionList; | 46 class VTTRegionList; |
46 | 47 |
47 class TextTrack : public TrackBase, public ScriptWrappable, public EventTargetWi thInlineData { | 48 class TextTrack : public TrackBase, public ScriptWrappable, public EventTargetWi thInlineData { |
48 REFCOUNTED_EVENT_TARGET(TrackBase); | 49 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<T rackBase>); |
49 public: | 50 public: |
50 static PassRefPtr<TextTrack> create(Document& document, const AtomicString& kind, const AtomicString& label, const AtomicString& language) | 51 static PassRefPtrWillBeRawPtr<TextTrack> create(Document& document, const At omicString& kind, const AtomicString& label, const AtomicString& language) |
51 { | 52 { |
52 return adoptRef(new TextTrack(document, kind, label, language, emptyAtom , AddTrack)); | 53 return adoptRefWillBeRefCountedGarbageCollected(new TextTrack(document, kind, label, language, emptyAtom, AddTrack)); |
53 } | 54 } |
54 virtual ~TextTrack(); | 55 virtual ~TextTrack(); |
55 | 56 |
56 virtual void setTrackList(TextTrackList*); | 57 virtual void setTrackList(TextTrackList*); |
57 TextTrackList* trackList() { return m_trackList; } | 58 TextTrackList* trackList() { return m_trackList; } |
58 | 59 |
59 virtual void setKind(const AtomicString&) OVERRIDE; | 60 virtual void setKind(const AtomicString&) OVERRIDE; |
60 | 61 |
61 static const AtomicString& subtitlesKeyword(); | 62 static const AtomicString& subtitlesKeyword(); |
62 static const AtomicString& captionsKeyword(); | 63 static const AtomicString& captionsKeyword(); |
(...skipping 11 matching lines...) Expand all Loading... | |
74 | 75 |
75 enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad = 3 }; | 76 enum ReadinessState { NotLoaded = 0, Loading = 1, Loaded = 2, FailedToLoad = 3 }; |
76 ReadinessState readinessState() const { return m_readinessState; } | 77 ReadinessState readinessState() const { return m_readinessState; } |
77 void setReadinessState(ReadinessState state) { m_readinessState = state; } | 78 void setReadinessState(ReadinessState state) { m_readinessState = state; } |
78 | 79 |
79 TextTrackCueList* cues(); | 80 TextTrackCueList* cues(); |
80 TextTrackCueList* activeCues() const; | 81 TextTrackCueList* activeCues() const; |
81 | 82 |
82 HTMLMediaElement* mediaElement(); | 83 HTMLMediaElement* mediaElement(); |
83 | 84 |
84 void addCue(PassRefPtr<TextTrackCue>); | 85 void addCue(PassRefPtrWillBeRawPtr<TextTrackCue>); |
85 void removeCue(TextTrackCue*, ExceptionState&); | 86 void removeCue(TextTrackCue*, ExceptionState&); |
86 | 87 |
87 VTTRegionList* regions(); | 88 VTTRegionList* regions(); |
88 void addRegion(PassRefPtr<VTTRegion>); | 89 void addRegion(PassRefPtrWillBeRawPtr<VTTRegion>); |
89 void removeRegion(VTTRegion*, ExceptionState&); | 90 void removeRegion(VTTRegion*, ExceptionState&); |
90 | 91 |
91 void cueWillChange(TextTrackCue*); | 92 void cueWillChange(TextTrackCue*); |
92 void cueDidChange(TextTrackCue*); | 93 void cueDidChange(TextTrackCue*); |
93 | 94 |
94 DEFINE_ATTRIBUTE_EVENT_LISTENER(cuechange); | 95 DEFINE_ATTRIBUTE_EVENT_LISTENER(cuechange); |
95 | 96 |
96 enum TextTrackType { TrackElement, AddTrack, InBand }; | 97 enum TextTrackType { TrackElement, AddTrack, InBand }; |
97 TextTrackType trackType() const { return m_trackType; } | 98 TextTrackType trackType() const { return m_trackType; } |
98 | 99 |
(...skipping 10 matching lines...) Expand all Loading... | |
109 virtual void setIsDefault(bool) { } | 110 virtual void setIsDefault(bool) { } |
110 | 111 |
111 void removeAllCues(); | 112 void removeAllCues(); |
112 | 113 |
113 Document& document() const { return *m_document; } | 114 Document& document() const { return *m_document; } |
114 | 115 |
115 // EventTarget methods | 116 // EventTarget methods |
116 virtual const AtomicString& interfaceName() const OVERRIDE; | 117 virtual const AtomicString& interfaceName() const OVERRIDE; |
117 virtual ExecutionContext* executionContext() const OVERRIDE; | 118 virtual ExecutionContext* executionContext() const OVERRIDE; |
118 | 119 |
120 virtual void trace(Visitor*) OVERRIDE; | |
121 | |
119 protected: | 122 protected: |
120 TextTrack(Document&, const AtomicString& kind, const AtomicString& label, co nst AtomicString& language, const AtomicString& id, TextTrackType); | 123 TextTrack(Document&, const AtomicString& kind, const AtomicString& label, co nst AtomicString& language, const AtomicString& id, TextTrackType); |
121 | 124 |
122 virtual bool isValidKind(const AtomicString& kind) const OVERRIDE { return i sValidKindKeyword(kind); } | 125 virtual bool isValidKind(const AtomicString& kind) const OVERRIDE { return i sValidKindKeyword(kind); } |
123 virtual AtomicString defaultKind() const OVERRIDE { return subtitlesKeyword( ); } | 126 virtual AtomicString defaultKind() const OVERRIDE { return subtitlesKeyword( ); } |
124 | 127 |
125 RefPtr<TextTrackCueList> m_cues; | 128 RefPtrWillBeMember<TextTrackCueList> m_cues; |
126 | 129 |
127 private: | 130 private: |
128 VTTRegionList* ensureVTTRegionList(); | 131 VTTRegionList* ensureVTTRegionList(); |
129 RefPtr<VTTRegionList> m_regions; | 132 RefPtrWillBeMember<VTTRegionList> m_regions; |
130 | 133 |
131 TextTrackCueList* ensureTextTrackCueList(); | 134 TextTrackCueList* ensureTextTrackCueList(); |
132 | 135 |
133 // FIXME: Remove this pointer and get the Document from m_client | 136 // FIXME: Remove this pointer and get the Document from m_client |
134 Document* m_document; | 137 Document* m_document; |
haraken
2014/04/21 01:30:54
This raw pointer looks safe, but if we fix the FIX
sof
2014/04/21 15:23:42
Done, I think.
| |
135 | 138 |
136 TextTrackList* m_trackList; | 139 RawPtrWillBeMember<TextTrackList> m_trackList; |
haraken
2014/04/21 01:30:54
Shouldn't this be a WeakMember? This pointer needs
sof
2014/04/21 15:23:42
I don't think it needs to be a weak reference. Lif
| |
137 AtomicString m_mode; | 140 AtomicString m_mode; |
138 TextTrackType m_trackType; | 141 TextTrackType m_trackType; |
139 ReadinessState m_readinessState; | 142 ReadinessState m_readinessState; |
140 int m_trackIndex; | 143 int m_trackIndex; |
141 int m_renderedTrackIndex; | 144 int m_renderedTrackIndex; |
142 bool m_hasBeenConfigured; | 145 bool m_hasBeenConfigured; |
143 }; | 146 }; |
144 | 147 |
145 } // namespace WebCore | 148 } // namespace WebCore |
146 | 149 |
147 #endif | 150 #endif |
OLD | NEW |