content/media/webspeech/recognition/SpeechGrammarList.cpp

Fri, 16 Jan 2015 04:50:19 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 04:50:19 +0100
branch
TOR_BUG_9701
changeset 13
44a2da4a2ab2
permissions
-rw-r--r--

Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32

     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/. */
     7 #include "SpeechGrammarList.h"
     9 #include "mozilla/dom/SpeechGrammarListBinding.h"
    10 #include "mozilla/ErrorResult.h"
    12 namespace mozilla {
    13 namespace dom {
    15 NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(SpeechGrammarList, mParent)
    16 NS_IMPL_CYCLE_COLLECTING_ADDREF(SpeechGrammarList)
    17 NS_IMPL_CYCLE_COLLECTING_RELEASE(SpeechGrammarList)
    18 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(SpeechGrammarList)
    19   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
    20   NS_INTERFACE_MAP_ENTRY(nsISupports)
    21 NS_INTERFACE_MAP_END
    23 SpeechGrammarList::SpeechGrammarList(nsISupports* aParent)
    24   : mParent(aParent)
    25 {
    26   SetIsDOMBinding();
    27 }
    29 SpeechGrammarList::~SpeechGrammarList()
    30 {
    31 }
    33 SpeechGrammarList*
    34 SpeechGrammarList::Constructor(const GlobalObject& aGlobal,
    35                                ErrorResult& aRv)
    36 {
    37   return new SpeechGrammarList(aGlobal.GetAsSupports());
    38 }
    40 JSObject*
    41 SpeechGrammarList::WrapObject(JSContext* aCx)
    42 {
    43   return SpeechGrammarListBinding::Wrap(aCx, this);
    44 }
    46 nsISupports*
    47 SpeechGrammarList::GetParentObject() const
    48 {
    49   return mParent;
    50 }
    52 uint32_t
    53 SpeechGrammarList::Length() const
    54 {
    55   return 0;
    56 }
    58 already_AddRefed<SpeechGrammar>
    59 SpeechGrammarList::Item(uint32_t aIndex, ErrorResult& aRv)
    60 {
    61   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
    62   return nullptr;
    63 }
    65 void
    66 SpeechGrammarList::AddFromURI(const nsAString& aSrc,
    67                               const Optional<float>& aWeight,
    68                               ErrorResult& aRv)
    69 {
    70   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
    71   return;
    72 }
    74 void
    75 SpeechGrammarList::AddFromString(const nsAString& aString,
    76                                  const Optional<float>& aWeight,
    77                                  ErrorResult& aRv)
    78 {
    79   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
    80   return;
    81 }
    83 already_AddRefed<SpeechGrammar>
    84 SpeechGrammarList::IndexedGetter(uint32_t aIndex, bool& aPresent,
    85                                  ErrorResult& aRv)
    86 {
    87   aRv.Throw(NS_ERROR_NOT_IMPLEMENTED);
    88   return nullptr;
    89 }
    90 } // namespace dom
    91 } // namespace mozilla

mercurial