Chromium Code Reviews

Side by Side Diff: Source/core/html/track/AudioTrackList.cpp

Issue 170233009: Initial implementation of AudioTrack, AudioTrackList, VideoTrack, and VideoTrackList. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@blink-master
Patch Set: Rebase Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
OLDNEW
(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 #include "config.h"
6 #include "core/html/track/AudioTrackList.h"
7
8 #include "core/html/HTMLMediaElement.h"
9 #include "core/html/track/AudioTrack.h"
10
11 namespace WebCore {
12
13 PassRefPtrWillBeRawPtr<AudioTrackList> AudioTrackList::create(HTMLMediaElement* mediaElement)
14 {
15 RefPtrWillBeRawPtr<AudioTrackList> trackList(adoptRefWillBeRefCountedGarbage Collected(new AudioTrackList(mediaElement)));
sof 2014/03/13 12:19:20 RefPtr<> + adoptRef()
acolwell GONE FROM CHROMIUM 2014/03/18 22:02:15 Done.
16 trackList->suspendIfNeeded();
17 return trackList.release();
18 }
19
20 AudioTrackList::~AudioTrackList()
21 {
22 }
23
24 AudioTrackList::AudioTrackList(HTMLMediaElement* mediaElement)
25 : TrackBaseList(mediaElement)
26 {
27 ScriptWrappable::init(this);
28 }
29
30 AudioTrack* AudioTrackList::anonymousIndexedGetter(unsigned index) const
31 {
32 return static_cast<AudioTrack*>(getByIndex(index));
33 }
34
35 AudioTrack* AudioTrackList::getTrackById(const AtomicString& id) const
36 {
37 return static_cast<AudioTrack*>(getById(id));
38 }
39
40 bool AudioTrackList::hasEnabledTrack() const
41 {
42 for (unsigned i = 0; i < length(); ++i) {
43 if (anonymousIndexedGetter(i)->enabled())
44 return true;
45 }
46
47 return false;
48 }
49
50 const AtomicString& AudioTrackList::interfaceName() const
51 {
52 return EventTargetNames::AudioTrackList;
53 }
54
55 }
OLDNEW

Powered by Google App Engine