OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef TrackBaseList_h |
| 6 #define TrackBaseList_h |
| 7 |
| 8 #include "core/dom/ActiveDOMObject.h" |
| 9 #include "core/events/EventTarget.h" |
| 10 #include "core/html/HTMLMediaElement.h" |
| 11 |
| 12 namespace WebCore { |
| 13 |
| 14 class GenericEventQueue; |
| 15 class TrackBase; |
| 16 |
| 17 class TrackBaseList : public RefCounted<TrackBaseList>, public EventTargetWithIn
lineData, public ActiveDOMObject { |
| 18 REFCOUNTED_EVENT_TARGET(TrackBaseList); |
| 19 |
| 20 public: |
| 21 explicit TrackBaseList(HTMLMediaElement*); |
| 22 virtual ~TrackBaseList(); |
| 23 |
| 24 unsigned length() const { return m_tracks.size(); } |
| 25 TrackBase* getByIndex(unsigned index) const; |
| 26 TrackBase* getById(const AtomicString& id) const; |
| 27 unsigned getIndex(const AtomicString& id) const; |
| 28 |
| 29 DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
| 30 DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); |
| 31 DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); |
| 32 |
| 33 // EventTarget interface |
| 34 virtual ExecutionContext* executionContext() const OVERRIDE; |
| 35 |
| 36 // ActiveDOMObject interface |
| 37 virtual bool hasPendingActivity() const OVERRIDE; |
| 38 virtual void stop() OVERRIDE; |
| 39 |
| 40 void shutdown(); |
| 41 |
| 42 void add(TrackBase*); |
| 43 void remove(const String& id); |
| 44 void removeAll(); |
| 45 |
| 46 void scheduleChangeEvent(); |
| 47 |
| 48 private: |
| 49 void scheduleTrackEvent(const AtomicString& eventName, PassRefPtr<TrackBase>
); |
| 50 |
| 51 bool m_shutdown; |
| 52 Vector<RefPtr<TrackBase> > m_tracks; |
| 53 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 54 }; |
| 55 |
| 56 } |
| 57 |
| 58 #endif |
OLD | NEW |