LCOV - code coverage report
Current view: top level - dom/media/webspeech/recognition - SpeechGrammarList.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 39 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 17 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 sts=2 et cindent: */
       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 "SpeechGrammarList.h"
       8             : 
       9             : #include "mozilla/dom/SpeechGrammarListBinding.h"
      10             : #include "mozilla/ErrorResult.h"
      11             : #include "nsCOMPtr.h"
      12             : #include "SpeechRecognition.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace dom {
      16             : 
      17           0 : NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(SpeechGrammarList, mParent, mItems)
      18           0 : NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechGrammarList)
      19           0 : NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechGrammarList)
      20           0 : NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechGrammarList)
      21           0 :   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
      22           0 :   NS_INTERFACE_MAP_ENTRY(nsISupports)
      23           0 : NS_INTERFACE_MAP_END
      24             : 
      25           0 : SpeechGrammarList::SpeechGrammarList(nsISupports* aParent)
      26           0 :   : mParent(aParent)
      27             : {
      28           0 : }
      29             : 
      30           0 : SpeechGrammarList::~SpeechGrammarList()
      31             : {
      32           0 : }
      33             : 
      34             : already_AddRefed<SpeechGrammarList>
      35           0 : SpeechGrammarList::Constructor(const GlobalObject& aGlobal,
      36             :                                ErrorResult& aRv)
      37             : {
      38             :   RefPtr<SpeechGrammarList> speechGrammarList =
      39           0 :     new SpeechGrammarList(aGlobal.GetAsSupports());
      40           0 :   return speechGrammarList.forget();
      41             : }
      42             : 
      43             : JSObject*
      44           0 : SpeechGrammarList::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
      45             : {
      46           0 :   return SpeechGrammarListBinding::Wrap(aCx, this, aGivenProto);
      47             : }
      48             : 
      49             : nsISupports*
      50           0 : SpeechGrammarList::GetParentObject() const
      51             : {
      52           0 :   return mParent;
      53             : }
      54             : 
      55             : uint32_t
      56           0 : SpeechGrammarList::Length() const
      57             : {
      58           0 :   return mItems.Length();
      59             : }
      60             : 
      61             : already_AddRefed<SpeechGrammar>
      62           0 : SpeechGrammarList::Item(uint32_t aIndex, ErrorResult& aRv)
      63             : {
      64           0 :   RefPtr<SpeechGrammar> result = mItems.ElementAt(aIndex);
      65           0 :   return result.forget();
      66             : }
      67             : 
      68             : void
      69           0 : SpeechGrammarList::AddFromURI(const nsAString& aSrc,
      70             :                               const Optional<float>& aWeight,
      71             :                               ErrorResult& aRv)
      72             : {
      73           0 :   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
      74           0 :   return;
      75             : }
      76             : 
      77             : void
      78           0 : SpeechGrammarList::AddFromString(const nsAString& aString,
      79             :                                  const Optional<float>& aWeight,
      80             :                                  ErrorResult& aRv)
      81             : {
      82           0 :   SpeechGrammar* speechGrammar = new SpeechGrammar(mParent);
      83           0 :   speechGrammar->SetSrc(aString, aRv);
      84           0 :   mItems.AppendElement(speechGrammar);
      85           0 :   return;
      86             : }
      87             : 
      88             : already_AddRefed<SpeechGrammar>
      89           0 : SpeechGrammarList::IndexedGetter(uint32_t aIndex, bool& aPresent,
      90             :                                  ErrorResult& aRv)
      91             : {
      92           0 :   if (aIndex >= Length()) {
      93           0 :     aPresent = false;
      94           0 :     return nullptr;
      95             :   }
      96           0 :   ErrorResult rv;
      97           0 :   aPresent = true;
      98           0 :   return Item(aIndex, rv);
      99             : }
     100             : 
     101             : } // namespace dom
     102             : } // namespace mozilla

Generated by: LCOV version 1.13