OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 13 matching lines...) Expand all Loading... |
24 */ | 24 */ |
25 | 25 |
26 #ifndef TextTrackList_h | 26 #ifndef TextTrackList_h |
27 #define TextTrackList_h | 27 #define TextTrackList_h |
28 | 28 |
29 #include "bindings/v8/ScriptWrappable.h" | 29 #include "bindings/v8/ScriptWrappable.h" |
30 #include "core/events/EventListener.h" | 30 #include "core/events/EventListener.h" |
31 #include "core/events/EventTarget.h" | 31 #include "core/events/EventTarget.h" |
32 #include "core/html/HTMLMediaElement.h" | 32 #include "core/html/HTMLMediaElement.h" |
33 #include "platform/Timer.h" | 33 #include "platform/Timer.h" |
| 34 #include "platform/heap/Handle.h" |
34 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
35 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
36 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
40 class GenericEventQueue; | 41 class GenericEventQueue; |
41 class TextTrack; | 42 class TextTrack; |
42 | 43 |
43 class TextTrackList FINAL : public RefCounted<TextTrackList>, public ScriptWrapp
able, public EventTargetWithInlineData { | 44 class TextTrackList FINAL : public RefCountedWillBeRefCountedGarbageCollected<Te
xtTrackList>, public ScriptWrappable, public EventTargetWithInlineData { |
44 REFCOUNTED_EVENT_TARGET(TextTrackList); | 45 DEFINE_EVENT_TARGET_REFCOUNTING(RefCountedWillBeRefCountedGarbageCollected<T
extTrackList>); |
45 public: | 46 public: |
46 static PassRefPtr<TextTrackList> create(HTMLMediaElement* owner) | 47 static PassRefPtrWillBeRawPtr<TextTrackList> create(HTMLMediaElement* owner) |
47 { | 48 { |
48 return adoptRef(new TextTrackList(owner)); | 49 return adoptRefWillBeRefCountedGarbageCollected(new TextTrackList(owner)
); |
49 } | 50 } |
50 virtual ~TextTrackList(); | 51 virtual ~TextTrackList(); |
| 52 void dispose(); |
51 | 53 |
52 unsigned length() const; | 54 unsigned length() const; |
53 int getTrackIndex(TextTrack*); | 55 int getTrackIndex(TextTrack*); |
54 int getTrackIndexRelativeToRenderedTracks(TextTrack*); | 56 int getTrackIndexRelativeToRenderedTracks(TextTrack*); |
55 bool contains(TextTrack*) const; | 57 bool contains(TextTrack*) const; |
56 | 58 |
57 TextTrack* item(unsigned index); | 59 TextTrack* item(unsigned index); |
58 TextTrack* getTrackById(const AtomicString& id); | 60 TextTrack* getTrackById(const AtomicString& id); |
59 void append(PassRefPtr<TextTrack>); | 61 void append(PassRefPtrWillBeRawPtr<TextTrack>); |
60 void remove(TextTrack*); | 62 void remove(TextTrack*); |
61 | 63 |
62 // EventTarget | 64 // EventTarget |
63 virtual const AtomicString& interfaceName() const OVERRIDE; | 65 virtual const AtomicString& interfaceName() const OVERRIDE; |
64 virtual ExecutionContext* executionContext() const OVERRIDE; | 66 virtual ExecutionContext* executionContext() const OVERRIDE; |
65 | 67 |
66 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); | 68 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); |
67 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); | 69 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
68 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); | 70 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); |
69 | 71 |
70 void clearOwner(); | 72 void clearOwner(); |
71 HTMLMediaElement* owner() const; | 73 HTMLMediaElement* owner() const; |
72 | 74 |
73 void scheduleChangeEvent(); | 75 void scheduleChangeEvent(); |
74 void removeAllInbandTracks(); | 76 void removeAllInbandTracks(); |
75 | 77 |
| 78 void trace(Visitor*); |
| 79 |
76 private: | 80 private: |
77 explicit TextTrackList(HTMLMediaElement*); | 81 explicit TextTrackList(HTMLMediaElement*); |
78 | 82 |
79 void scheduleTrackEvent(const AtomicString& eventName, PassRefPtr<TextTrack>
); | 83 void scheduleTrackEvent(const AtomicString& eventName, PassRefPtrWillBeRawPt
r<TextTrack>); |
80 | 84 |
81 void scheduleAddTrackEvent(PassRefPtr<TextTrack>); | 85 void scheduleAddTrackEvent(PassRefPtrWillBeRawPtr<TextTrack>); |
82 void scheduleRemoveTrackEvent(PassRefPtr<TextTrack>); | 86 void scheduleRemoveTrackEvent(PassRefPtrWillBeRawPtr<TextTrack>); |
83 | 87 |
84 void invalidateTrackIndexesAfterTrack(TextTrack*); | 88 void invalidateTrackIndexesAfterTrack(TextTrack*); |
85 | 89 |
86 HTMLMediaElement* m_owner; | 90 HTMLMediaElement* m_owner; |
87 | 91 |
88 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 92 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
89 | 93 |
90 Vector<RefPtr<TextTrack> > m_addTrackTracks; | 94 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > m_addTrackTracks; |
91 Vector<RefPtr<TextTrack> > m_elementTracks; | 95 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > m_elementTracks; |
92 Vector<RefPtr<TextTrack> > m_inbandTracks; | 96 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > m_inbandTracks; |
93 }; | 97 }; |
94 | 98 |
95 } // namespace WebCore | 99 } // namespace WebCore |
96 | 100 |
97 #endif | 101 #endif |
OLD | NEW |