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