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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_SpeechSynthesis_h
8 #define mozilla_dom_SpeechSynthesis_h
10 #include "nsCOMPtr.h"
11 #include "nsString.h"
12 #include "nsWrapperCache.h"
13 #include "nsRefPtrHashtable.h"
14 #include "js/TypeDecls.h"
16 #include "SpeechSynthesisUtterance.h"
17 #include "SpeechSynthesisVoice.h"
19 class nsIDOMWindow;
21 namespace mozilla {
22 namespace dom {
24 class nsSpeechTask;
26 class SpeechSynthesis MOZ_FINAL : public nsISupports,
27 public nsWrapperCache
28 {
29 public:
30 SpeechSynthesis(nsPIDOMWindow* aParent);
31 virtual ~SpeechSynthesis();
33 NS_DECL_CYCLE_COLLECTING_ISUPPORTS
34 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(SpeechSynthesis)
36 nsIDOMWindow* GetParentObject() const;
38 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
40 bool Pending() const;
42 bool Speaking() const;
44 bool Paused() const;
46 void Speak(SpeechSynthesisUtterance& aUtterance);
48 void Cancel();
50 void Pause();
52 void Resume();
54 void OnEnd(const nsSpeechTask* aTask);
56 void GetVoices(nsTArray< nsRefPtr<SpeechSynthesisVoice> >& aResult);
58 private:
60 void AdvanceQueue();
62 nsCOMPtr<nsPIDOMWindow> mParent;
64 nsTArray<nsRefPtr<SpeechSynthesisUtterance> > mSpeechQueue;
66 nsRefPtr<nsSpeechTask> mCurrentTask;
68 nsRefPtrHashtable<nsStringHashKey, SpeechSynthesisVoice> mVoiceCache;
69 };
71 } // namespace dom
72 } // namespace mozilla
74 #endif