LCOV - code coverage report
Current view: top level - dom/media - AudioTrack.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 24 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 4 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim:set ts=2 sw=2 et tw=78: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #include "mozilla/dom/AudioTrack.h"
       8             : #include "mozilla/dom/AudioTrackBinding.h"
       9             : #include "mozilla/dom/AudioTrackList.h"
      10             : #include "mozilla/dom/HTMLMediaElement.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace dom {
      14             : 
      15           0 : AudioTrack::AudioTrack(const nsAString& aId,
      16             :                        const nsAString& aKind,
      17             :                        const nsAString& aLabel,
      18             :                        const nsAString& aLanguage,
      19           0 :                        bool aEnabled)
      20             :   : MediaTrack(aId, aKind, aLabel, aLanguage)
      21           0 :   , mEnabled(aEnabled)
      22             : {
      23           0 : }
      24             : 
      25             : JSObject*
      26           0 : AudioTrack::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
      27             : {
      28           0 :   return AudioTrackBinding::Wrap(aCx, this, aGivenProto);
      29             : }
      30             : 
      31             : void
      32           0 : AudioTrack::SetEnabled(bool aEnabled)
      33             : {
      34           0 :   SetEnabledInternal(aEnabled, MediaTrack::DEFAULT);
      35           0 : }
      36             : 
      37             : void
      38           0 : AudioTrack::SetEnabledInternal(bool aEnabled, int aFlags)
      39             : {
      40           0 :   if (aEnabled == mEnabled) {
      41           0 :     return;
      42             :   }
      43           0 :   mEnabled = aEnabled;
      44             : 
      45             :   // If this AudioTrack is no longer in its original AudioTrackList, then
      46             :   // whether it is enabled or not has no effect on its original list.
      47           0 :   if (!mList) {
      48           0 :     return;
      49             :   }
      50             : 
      51           0 :   if (mEnabled) {
      52           0 :     HTMLMediaElement* element = mList->GetMediaElement();
      53           0 :     if (element) {
      54           0 :       element->NotifyMediaTrackEnabled(this);
      55             :     }
      56             :   } else {
      57           0 :     HTMLMediaElement* element = mList->GetMediaElement();
      58           0 :     if (element) {
      59           0 :       element->NotifyMediaTrackDisabled(this);
      60             :     }
      61             :   }
      62             : 
      63           0 :   if (!(aFlags & MediaTrack::FIRE_NO_EVENTS)) {
      64           0 :     mList->CreateAndDispatchChangeEvent();
      65             :   }
      66             : }
      67             : 
      68             : } // namespace dom
      69             : } //namespace mozilla

Generated by: LCOV version 1.13