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

          Line data    Source code
       1             : /* This Source Code Form is subject to the terms of the Mozilla Public
       2             :  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
       3             :  * You can obtain one at http://mozilla.org/MPL/2.0/. */
       4             : 
       5             : #include "SpeechSynthesisChild.h"
       6             : #include "nsSynthVoiceRegistry.h"
       7             : 
       8             : namespace mozilla {
       9             : namespace dom {
      10             : 
      11           0 : SpeechSynthesisChild::SpeechSynthesisChild()
      12             : {
      13           0 :   MOZ_COUNT_CTOR(SpeechSynthesisChild);
      14           0 : }
      15             : 
      16           0 : SpeechSynthesisChild::~SpeechSynthesisChild()
      17             : {
      18           0 :   MOZ_COUNT_DTOR(SpeechSynthesisChild);
      19           0 : }
      20             : 
      21             : mozilla::ipc::IPCResult
      22           0 : SpeechSynthesisChild::RecvInitialVoicesAndState(nsTArray<RemoteVoice>&& aVoices,
      23             :                                                 nsTArray<nsString>&& aDefaults,
      24             :                                                 const bool& aIsSpeaking)
      25             : {
      26           0 :   nsSynthVoiceRegistry::RecvInitialVoicesAndState(aVoices, aDefaults, aIsSpeaking);
      27           0 :   return IPC_OK();
      28             : }
      29             : 
      30             : mozilla::ipc::IPCResult
      31           0 : SpeechSynthesisChild::RecvVoiceAdded(const RemoteVoice& aVoice)
      32             : {
      33           0 :   nsSynthVoiceRegistry::RecvAddVoice(aVoice);
      34           0 :   return IPC_OK();
      35             : }
      36             : 
      37             : mozilla::ipc::IPCResult
      38           0 : SpeechSynthesisChild::RecvVoiceRemoved(const nsString& aUri)
      39             : {
      40           0 :   nsSynthVoiceRegistry::RecvRemoveVoice(aUri);
      41           0 :   return IPC_OK();
      42             : }
      43             : 
      44             : mozilla::ipc::IPCResult
      45           0 : SpeechSynthesisChild::RecvSetDefaultVoice(const nsString& aUri,
      46             :                                           const bool& aIsDefault)
      47             : {
      48           0 :   nsSynthVoiceRegistry::RecvSetDefaultVoice(aUri, aIsDefault);
      49           0 :   return IPC_OK();
      50             : }
      51             : 
      52             : mozilla::ipc::IPCResult
      53           0 : SpeechSynthesisChild::RecvIsSpeakingChanged(const bool& aIsSpeaking)
      54             : {
      55           0 :   nsSynthVoiceRegistry::RecvIsSpeakingChanged(aIsSpeaking);
      56           0 :   return IPC_OK();
      57             : }
      58             : 
      59             : mozilla::ipc::IPCResult
      60           0 : SpeechSynthesisChild::RecvNotifyVoicesChanged()
      61             : {
      62           0 :   nsSynthVoiceRegistry::RecvNotifyVoicesChanged();
      63           0 :   return IPC_OK();
      64             : }
      65             : 
      66             : PSpeechSynthesisRequestChild*
      67           0 : SpeechSynthesisChild::AllocPSpeechSynthesisRequestChild(const nsString& aText,
      68             :                                                         const nsString& aLang,
      69             :                                                         const nsString& aUri,
      70             :                                                         const float& aVolume,
      71             :                                                         const float& aRate,
      72             :                                                         const float& aPitch)
      73             : {
      74           0 :   MOZ_CRASH("Caller is supposed to manually construct a request!");
      75             : }
      76             : 
      77             : bool
      78           0 : SpeechSynthesisChild::DeallocPSpeechSynthesisRequestChild(PSpeechSynthesisRequestChild* aActor)
      79             : {
      80           0 :   delete aActor;
      81           0 :   return true;
      82             : }
      83             : 
      84             : // SpeechSynthesisRequestChild
      85             : 
      86           0 : SpeechSynthesisRequestChild::SpeechSynthesisRequestChild(SpeechTaskChild* aTask)
      87           0 :   : mTask(aTask)
      88             : {
      89           0 :   mTask->mActor = this;
      90           0 :   MOZ_COUNT_CTOR(SpeechSynthesisRequestChild);
      91           0 : }
      92             : 
      93           0 : SpeechSynthesisRequestChild::~SpeechSynthesisRequestChild()
      94             : {
      95           0 :   MOZ_COUNT_DTOR(SpeechSynthesisRequestChild);
      96           0 : }
      97             : 
      98             : mozilla::ipc::IPCResult
      99           0 : SpeechSynthesisRequestChild::RecvOnStart(const nsString& aUri)
     100             : {
     101           0 :   mTask->DispatchStartImpl(aUri);
     102           0 :   return IPC_OK();
     103             : }
     104             : 
     105             : mozilla::ipc::IPCResult
     106           0 : SpeechSynthesisRequestChild::RecvOnEnd(const bool& aIsError,
     107             :                                        const float& aElapsedTime,
     108             :                                        const uint32_t& aCharIndex)
     109             : {
     110           0 :   SpeechSynthesisRequestChild* actor = mTask->mActor;
     111           0 :   mTask->mActor = nullptr;
     112             : 
     113           0 :   if (aIsError) {
     114           0 :     mTask->DispatchErrorImpl(aElapsedTime, aCharIndex);
     115             :   } else {
     116           0 :     mTask->DispatchEndImpl(aElapsedTime, aCharIndex);
     117             :   }
     118             : 
     119           0 :   actor->Send__delete__(actor);
     120             : 
     121           0 :   return IPC_OK();
     122             : }
     123             : 
     124             : mozilla::ipc::IPCResult
     125           0 : SpeechSynthesisRequestChild::RecvOnPause(const float& aElapsedTime,
     126             :                                          const uint32_t& aCharIndex)
     127             : {
     128           0 :   mTask->DispatchPauseImpl(aElapsedTime, aCharIndex);
     129           0 :   return IPC_OK();
     130             : }
     131             : 
     132             : mozilla::ipc::IPCResult
     133           0 : SpeechSynthesisRequestChild::RecvOnResume(const float& aElapsedTime,
     134             :                                           const uint32_t& aCharIndex)
     135             : {
     136           0 :   mTask->DispatchResumeImpl(aElapsedTime, aCharIndex);
     137           0 :   return IPC_OK();
     138             : }
     139             : 
     140             : mozilla::ipc::IPCResult
     141           0 : SpeechSynthesisRequestChild::RecvOnBoundary(const nsString& aName,
     142             :                                             const float& aElapsedTime,
     143             :                                             const uint32_t& aCharIndex,
     144             :                                             const uint32_t& aCharLength,
     145             :                                             const uint8_t& argc)
     146             : {
     147           0 :   mTask->DispatchBoundaryImpl(aName, aElapsedTime, aCharIndex, aCharLength, argc);
     148           0 :   return IPC_OK();
     149             : }
     150             : 
     151             : mozilla::ipc::IPCResult
     152           0 : SpeechSynthesisRequestChild::RecvOnMark(const nsString& aName,
     153             :                                         const float& aElapsedTime,
     154             :                                         const uint32_t& aCharIndex)
     155             : {
     156           0 :   mTask->DispatchMarkImpl(aName, aElapsedTime, aCharIndex);
     157           0 :   return IPC_OK();
     158             : }
     159             : 
     160             : // SpeechTaskChild
     161             : 
     162           0 : SpeechTaskChild::SpeechTaskChild(SpeechSynthesisUtterance* aUtterance)
     163           0 :   : nsSpeechTask(aUtterance)
     164             : {
     165           0 : }
     166             : 
     167             : NS_IMETHODIMP
     168           0 : SpeechTaskChild::Setup(nsISpeechTaskCallback* aCallback,
     169             :                        uint32_t aChannels, uint32_t aRate, uint8_t argc)
     170             : {
     171           0 :   MOZ_CRASH("Should never be called from child");
     172             : }
     173             : 
     174             : NS_IMETHODIMP
     175           0 : SpeechTaskChild::SendAudio(JS::Handle<JS::Value> aData, JS::Handle<JS::Value> aLandmarks,
     176             :                            JSContext* aCx)
     177             : {
     178           0 :   MOZ_CRASH("Should never be called from child");
     179             : }
     180             : 
     181             : NS_IMETHODIMP
     182           0 : SpeechTaskChild::SendAudioNative(int16_t* aData, uint32_t aDataLen)
     183             : {
     184           0 :   MOZ_CRASH("Should never be called from child");
     185             : }
     186             : 
     187             : void
     188           0 : SpeechTaskChild::Pause()
     189             : {
     190           0 :   MOZ_ASSERT(mActor);
     191           0 :   mActor->SendPause();
     192           0 : }
     193             : 
     194             : void
     195           0 : SpeechTaskChild::Resume()
     196             : {
     197           0 :   MOZ_ASSERT(mActor);
     198           0 :   mActor->SendResume();
     199           0 : }
     200             : 
     201             : void
     202           0 : SpeechTaskChild::Cancel()
     203             : {
     204           0 :   MOZ_ASSERT(mActor);
     205           0 :   mActor->SendCancel();
     206           0 : }
     207             : 
     208             : void
     209           0 : SpeechTaskChild::ForceEnd()
     210             : {
     211           0 :   MOZ_ASSERT(mActor);
     212           0 :   mActor->SendForceEnd();
     213           0 : }
     214             : 
     215             : void
     216           0 : SpeechTaskChild::SetAudioOutputVolume(float aVolume)
     217             : {
     218           0 :   if (mActor) {
     219           0 :     mActor->SendSetAudioOutputVolume(aVolume);
     220             :   }
     221           0 : }
     222             : 
     223             : } // namespace dom
     224             : } // namespace mozilla

Generated by: LCOV version 1.13