content/media/webspeech/synth/ipc/SpeechSynthesisParent.h

Tue, 06 Jan 2015 21:39:09 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Tue, 06 Jan 2015 21:39:09 +0100
branch
TOR_BUG_9701
changeset 8
97036ab72558
permissions
-rw-r--r--

Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

     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/. */
     5 #ifndef mozilla_dom_SpeechSynthesisParent_h
     6 #define mozilla_dom_SpeechSynthesisParent_h
     8 #include "mozilla/dom/PSpeechSynthesisParent.h"
     9 #include "mozilla/dom/PSpeechSynthesisRequestParent.h"
    10 #include "nsSpeechTask.h"
    12 namespace mozilla {
    13 namespace dom {
    15 class ContentParent;
    16 class SpeechTaskParent;
    17 class SpeechSynthesisRequestParent;
    19 class SpeechSynthesisParent : public PSpeechSynthesisParent
    20 {
    21   friend class ContentParent;
    22   friend class SpeechSynthesisRequestParent;
    24 public:
    25   bool RecvReadVoiceList(InfallibleTArray<RemoteVoice>* aVoices,
    26                          InfallibleTArray<nsString>* aDefaults) MOZ_OVERRIDE;
    28 protected:
    29   SpeechSynthesisParent();
    30   virtual ~SpeechSynthesisParent();
    31   PSpeechSynthesisRequestParent* AllocPSpeechSynthesisRequestParent(const nsString& aText,
    32                                                                     const nsString& aLang,
    33                                                                     const nsString& aUri,
    34                                                                     const float& aVolume,
    35                                                                     const float& aRate,
    36                                                                     const float& aPitch)
    37                                                                     MOZ_OVERRIDE;
    39   bool DeallocPSpeechSynthesisRequestParent(PSpeechSynthesisRequestParent* aActor) MOZ_OVERRIDE;
    41   bool RecvPSpeechSynthesisRequestConstructor(PSpeechSynthesisRequestParent* aActor,
    42                                               const nsString& aText,
    43                                               const nsString& aLang,
    44                                               const nsString& aUri,
    45                                               const float& aVolume,
    46                                               const float& aRate,
    47                                               const float& aPitch) MOZ_OVERRIDE;
    48 };
    50 class SpeechSynthesisRequestParent : public PSpeechSynthesisRequestParent
    51 {
    52 public:
    53   SpeechSynthesisRequestParent(SpeechTaskParent* aTask);
    54   virtual ~SpeechSynthesisRequestParent();
    56   nsRefPtr<SpeechTaskParent> mTask;
    58 protected:
    60   virtual bool RecvPause() MOZ_OVERRIDE;
    62   virtual bool RecvResume() MOZ_OVERRIDE;
    64   virtual bool RecvCancel() MOZ_OVERRIDE;
    65 };
    67 class SpeechTaskParent : public nsSpeechTask
    68 {
    69   friend class SpeechSynthesisRequestParent;
    70 public:
    71   SpeechTaskParent(float aVolume, const nsAString& aUtterance)
    72     : nsSpeechTask(aVolume, aUtterance) {}
    74   virtual nsresult DispatchStartImpl();
    76   virtual nsresult DispatchEndImpl(float aElapsedTime, uint32_t aCharIndex);
    78   virtual nsresult DispatchPauseImpl(float aElapsedTime, uint32_t aCharIndex);
    80   virtual nsresult DispatchResumeImpl(float aElapsedTime, uint32_t aCharIndex);
    82   virtual nsresult DispatchErrorImpl(float aElapsedTime, uint32_t aCharIndex);
    84   virtual nsresult DispatchBoundaryImpl(const nsAString& aName,
    85                                         float aElapsedTime, uint32_t aCharIndex);
    87   virtual nsresult DispatchMarkImpl(const nsAString& aName,
    88                                     float aElapsedTime, uint32_t aCharIndex);
    90 private:
    91   SpeechSynthesisRequestParent* mActor;
    92 };
    94 } // namespace dom
    95 } // namespace mozilla
    97 #endif

mercurial