Chromium Code Reviews| Index: Source/core/html/track/TrackBaseList.h |
| diff --git a/Source/core/html/track/TrackBaseList.h b/Source/core/html/track/TrackBaseList.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..194a34e81114e9e00b065cb484a9210ff6df54ad |
| --- /dev/null |
| +++ b/Source/core/html/track/TrackBaseList.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef TrackBaseList_h |
| +#define TrackBaseList_h |
| + |
| +#include "core/dom/ActiveDOMObject.h" |
| +#include "core/events/EventTarget.h" |
| +#include "core/html/HTMLMediaElement.h" |
| + |
| +namespace WebCore { |
| + |
| +class GenericEventQueue; |
| +class TrackBase; |
| + |
| +class TrackBaseList : public RefCounted<TrackBaseList>, public EventTargetWithInlineData, public ActiveDOMObject { |
| + REFCOUNTED_EVENT_TARGET(TrackBaseList); |
| + |
| +public: |
| + TrackBaseList(HTMLMediaElement*); |
|
Inactive
2014/03/08 03:05:59
explicit?
acolwell GONE FROM CHROMIUM
2014/03/08 19:56:42
Done.
|
| + ~TrackBaseList(); |
|
Inactive
2014/03/08 03:05:59
Would be nice to make it explicitly virtual
acolwell GONE FROM CHROMIUM
2014/03/08 19:56:42
Done.
|
| + |
| + unsigned length() const { return m_tracks.size(); } |
| + TrackBase* getByIndex(unsigned index) const; |
| + TrackBase* getById(const AtomicString& id) const; |
| + unsigned getIndex(const AtomicString& id) const; |
| + |
| + DEFINE_ATTRIBUTE_EVENT_LISTENER(change); |
| + DEFINE_ATTRIBUTE_EVENT_LISTENER(addtrack); |
| + DEFINE_ATTRIBUTE_EVENT_LISTENER(removetrack); |
| + |
| + // EventTarget interface |
| + virtual ExecutionContext* executionContext() const OVERRIDE; |
| + |
| + // ActiveDOMObject interface |
| + virtual bool hasPendingActivity() const OVERRIDE; |
| + virtual void stop() OVERRIDE; |
| + |
| + void shutdown(); |
| + |
| + void add(TrackBase*); |
| + void remove(const String& id); |
| + void removeAll(); |
| + |
| + void scheduleChangeEvent(); |
| + |
| +private: |
| + void scheduleTrackEvent(const AtomicString& eventName, PassRefPtr<TrackBase>); |
| + |
| + bool m_shutdown; |
| + Vector<RefPtr<TrackBase> > m_tracks; |
| + OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| +}; |
| + |
| +} |
| + |
| +#endif |