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.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
michael@0 3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #ifndef mozilla_dom_SpeechSynthesisParent_h
michael@0 6 #define mozilla_dom_SpeechSynthesisParent_h
michael@0 7
michael@0 8 #include "mozilla/dom/PSpeechSynthesisParent.h"
michael@0 9 #include "mozilla/dom/PSpeechSynthesisRequestParent.h"
michael@0 10 #include "nsSpeechTask.h"
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13 namespace dom {
michael@0 14
michael@0 15 class ContentParent;
michael@0 16 class SpeechTaskParent;
michael@0 17 class SpeechSynthesisRequestParent;
michael@0 18
michael@0 19 class SpeechSynthesisParent : public PSpeechSynthesisParent
michael@0 20 {
michael@0 21 friend class ContentParent;
michael@0 22 friend class SpeechSynthesisRequestParent;
michael@0 23
michael@0 24 public:
michael@0 25 bool RecvReadVoiceList(InfallibleTArray<RemoteVoice>* aVoices,
michael@0 26 InfallibleTArray<nsString>* aDefaults) MOZ_OVERRIDE;
michael@0 27
michael@0 28 protected:
michael@0 29 SpeechSynthesisParent();
michael@0 30 virtual ~SpeechSynthesisParent();
michael@0 31 PSpeechSynthesisRequestParent* AllocPSpeechSynthesisRequestParent(const nsString& aText,
michael@0 32 const nsString& aLang,
michael@0 33 const nsString& aUri,
michael@0 34 const float& aVolume,
michael@0 35 const float& aRate,
michael@0 36 const float& aPitch)
michael@0 37 MOZ_OVERRIDE;
michael@0 38
michael@0 39 bool DeallocPSpeechSynthesisRequestParent(PSpeechSynthesisRequestParent* aActor) MOZ_OVERRIDE;
michael@0 40
michael@0 41 bool RecvPSpeechSynthesisRequestConstructor(PSpeechSynthesisRequestParent* aActor,
michael@0 42 const nsString& aText,
michael@0 43 const nsString& aLang,
michael@0 44 const nsString& aUri,
michael@0 45 const float& aVolume,
michael@0 46 const float& aRate,
michael@0 47 const float& aPitch) MOZ_OVERRIDE;
michael@0 48 };
michael@0 49
michael@0 50 class SpeechSynthesisRequestParent : public PSpeechSynthesisRequestParent
michael@0 51 {
michael@0 52 public:
michael@0 53 SpeechSynthesisRequestParent(SpeechTaskParent* aTask);
michael@0 54 virtual ~SpeechSynthesisRequestParent();
michael@0 55
michael@0 56 nsRefPtr<SpeechTaskParent> mTask;
michael@0 57
michael@0 58 protected:
michael@0 59
michael@0 60 virtual bool RecvPause() MOZ_OVERRIDE;
michael@0 61
michael@0 62 virtual bool RecvResume() MOZ_OVERRIDE;
michael@0 63
michael@0 64 virtual bool RecvCancel() MOZ_OVERRIDE;
michael@0 65 };
michael@0 66
michael@0 67 class SpeechTaskParent : public nsSpeechTask
michael@0 68 {
michael@0 69 friend class SpeechSynthesisRequestParent;
michael@0 70 public:
michael@0 71 SpeechTaskParent(float aVolume, const nsAString& aUtterance)
michael@0 72 : nsSpeechTask(aVolume, aUtterance) {}
michael@0 73
michael@0 74 virtual nsresult DispatchStartImpl();
michael@0 75
michael@0 76 virtual nsresult DispatchEndImpl(float aElapsedTime, uint32_t aCharIndex);
michael@0 77
michael@0 78 virtual nsresult DispatchPauseImpl(float aElapsedTime, uint32_t aCharIndex);
michael@0 79
michael@0 80 virtual nsresult DispatchResumeImpl(float aElapsedTime, uint32_t aCharIndex);
michael@0 81
michael@0 82 virtual nsresult DispatchErrorImpl(float aElapsedTime, uint32_t aCharIndex);
michael@0 83
michael@0 84 virtual nsresult DispatchBoundaryImpl(const nsAString& aName,
michael@0 85 float aElapsedTime, uint32_t aCharIndex);
michael@0 86
michael@0 87 virtual nsresult DispatchMarkImpl(const nsAString& aName,
michael@0 88 float aElapsedTime, uint32_t aCharIndex);
michael@0 89
michael@0 90 private:
michael@0 91 SpeechSynthesisRequestParent* mActor;
michael@0 92 };
michael@0 93
michael@0 94 } // namespace dom
michael@0 95 } // namespace mozilla
michael@0 96
michael@0 97 #endif

mercurial