Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1392)

Unified Diff: Source/core/html/track/TrackBaseList.h

Issue 170233009: Initial implementation of AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@blink-master
Patch Set: Rebased, reworked impl, and addressed comments. Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698