Keep auxilliary media objects on the heap always.
[chromium-blink-merge.git] / third_party / WebKit / Source / core / html / track / AudioTrack.cpp
blob7bf36b124bf4b3958e22512aae501976d5f8c4ed
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.
5 #include "config.h"
6 #include "core/html/track/AudioTrack.h"
8 #include "core/html/HTMLMediaElement.h"
10 namespace blink {
12 AudioTrack::AudioTrack(const String& id, const AtomicString& kind, const AtomicString& label, const AtomicString& language, bool enabled)
13 : TrackBase(TrackBase::AudioTrack, label, language, id)
14 , m_enabled(enabled)
16 setKind(kind);
19 AudioTrack::~AudioTrack()
23 DEFINE_TRACE(AudioTrack)
25 TrackBase::trace(visitor);
28 void AudioTrack::setEnabled(bool enabled)
30 if (enabled == m_enabled)
31 return;
33 m_enabled = enabled;
35 if (mediaElement())
36 mediaElement()->audioTrackChanged();
39 const AtomicString& AudioTrack::alternativeKeyword()
41 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("alternative", AtomicString::ConstructFromLiteral));
42 return keyword;
45 const AtomicString& AudioTrack::descriptionsKeyword()
47 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("descriptions", AtomicString::ConstructFromLiteral));
48 return keyword;
51 const AtomicString& AudioTrack::mainKeyword()
53 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main", AtomicString::ConstructFromLiteral));
54 return keyword;
57 const AtomicString& AudioTrack::mainDescriptionsKeyword()
59 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("main-desc", AtomicString::ConstructFromLiteral));
60 return keyword;
63 const AtomicString& AudioTrack::translationKeyword()
65 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("translation", AtomicString::ConstructFromLiteral));
66 return keyword;
69 const AtomicString& AudioTrack::commentaryKeyword()
71 DEFINE_STATIC_LOCAL(const AtomicString, keyword, ("commentary", AtomicString::ConstructFromLiteral));
72 return keyword;
75 bool AudioTrack::isValidKindKeyword(const String& kind)
77 return (kind == alternativeKeyword())
78 || (kind == descriptionsKeyword())
79 || (kind == mainKeyword())
80 || (kind == mainDescriptionsKeyword())
81 || (kind == translationKeyword())
82 || (kind == commentaryKeyword())
83 || (kind == emptyAtom);
86 AtomicString AudioTrack::defaultKind() const
88 return emptyAtom;