content/media/webspeech/synth/ipc/SpeechSynthesisChild.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_SpeechSynthesisChild_h
michael@0 6 #define mozilla_dom_SpeechSynthesisChild_h
michael@0 7
michael@0 8 #include "mozilla/Attributes.h"
michael@0 9 #include "mozilla/dom/PSpeechSynthesisChild.h"
michael@0 10 #include "mozilla/dom/PSpeechSynthesisRequestChild.h"
michael@0 11 #include "nsSpeechTask.h"
michael@0 12
michael@0 13 namespace mozilla {
michael@0 14 namespace dom {
michael@0 15
michael@0 16 class nsSynthVoiceRegistry;
michael@0 17 class SpeechSynthesisRequestChild;
michael@0 18 class SpeechTaskChild;
michael@0 19
michael@0 20 class SpeechSynthesisChild : public PSpeechSynthesisChild
michael@0 21 {
michael@0 22 friend class nsSynthVoiceRegistry;
michael@0 23
michael@0 24 public:
michael@0 25 bool RecvVoiceAdded(const RemoteVoice& aVoice) MOZ_OVERRIDE;
michael@0 26
michael@0 27 bool RecvVoiceRemoved(const nsString& aUri) MOZ_OVERRIDE;
michael@0 28
michael@0 29 bool RecvSetDefaultVoice(const nsString& aUri, const bool& aIsDefault) MOZ_OVERRIDE;
michael@0 30
michael@0 31 protected:
michael@0 32 SpeechSynthesisChild();
michael@0 33 virtual ~SpeechSynthesisChild();
michael@0 34
michael@0 35 PSpeechSynthesisRequestChild* AllocPSpeechSynthesisRequestChild(const nsString& aLang,
michael@0 36 const nsString& aUri,
michael@0 37 const nsString& aText,
michael@0 38 const float& aVolume,
michael@0 39 const float& aPitch,
michael@0 40 const float& aRate) MOZ_OVERRIDE;
michael@0 41 bool DeallocPSpeechSynthesisRequestChild(PSpeechSynthesisRequestChild* aActor) MOZ_OVERRIDE;
michael@0 42 };
michael@0 43
michael@0 44 class SpeechSynthesisRequestChild : public PSpeechSynthesisRequestChild
michael@0 45 {
michael@0 46 public:
michael@0 47 SpeechSynthesisRequestChild(SpeechTaskChild* aTask);
michael@0 48 virtual ~SpeechSynthesisRequestChild();
michael@0 49
michael@0 50 protected:
michael@0 51 virtual bool RecvOnStart() MOZ_OVERRIDE;
michael@0 52
michael@0 53 virtual bool Recv__delete__(const bool& aIsError,
michael@0 54 const float& aElapsedTime,
michael@0 55 const uint32_t& aCharIndex) MOZ_OVERRIDE;
michael@0 56
michael@0 57 virtual bool RecvOnPause(const float& aElapsedTime, const uint32_t& aCharIndex) MOZ_OVERRIDE;
michael@0 58
michael@0 59 virtual bool RecvOnResume(const float& aElapsedTime, const uint32_t& aCharIndex) MOZ_OVERRIDE;
michael@0 60
michael@0 61 virtual bool RecvOnBoundary(const nsString& aName, const float& aElapsedTime,
michael@0 62 const uint32_t& aCharIndex) MOZ_OVERRIDE;
michael@0 63
michael@0 64 virtual bool RecvOnMark(const nsString& aName, const float& aElapsedTime,
michael@0 65 const uint32_t& aCharIndex) MOZ_OVERRIDE;
michael@0 66
michael@0 67 nsRefPtr<SpeechTaskChild> mTask;
michael@0 68 };
michael@0 69
michael@0 70 class SpeechTaskChild : public nsSpeechTask
michael@0 71 {
michael@0 72 friend class SpeechSynthesisRequestChild;
michael@0 73 public:
michael@0 74
michael@0 75 SpeechTaskChild(SpeechSynthesisUtterance* aUtterance);
michael@0 76
michael@0 77 NS_IMETHOD Setup(nsISpeechTaskCallback* aCallback,
michael@0 78 uint32_t aChannels, uint32_t aRate, uint8_t argc) MOZ_OVERRIDE;
michael@0 79
michael@0 80 NS_IMETHOD SendAudio(JS::Handle<JS::Value> aData, JS::Handle<JS::Value> aLandmarks,
michael@0 81 JSContext* aCx) MOZ_OVERRIDE;
michael@0 82
michael@0 83 NS_IMETHOD SendAudioNative(int16_t* aData, uint32_t aDataLen) MOZ_OVERRIDE;
michael@0 84
michael@0 85 virtual void Pause();
michael@0 86
michael@0 87 virtual void Resume();
michael@0 88
michael@0 89 virtual void Cancel();
michael@0 90
michael@0 91 private:
michael@0 92 SpeechSynthesisRequestChild* mActor;
michael@0 93 };
michael@0 94
michael@0 95 } // namespace dom
michael@0 96 } // namespace mozilla
michael@0 97
michael@0 98 #endif

mercurial