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 PeriodicWave_h_
8 #define PeriodicWave_h_
10 #include "nsWrapperCache.h"
11 #include "nsCycleCollectionParticipant.h"
12 #include "mozilla/Attributes.h"
13 #include "AudioContext.h"
14 #include "AudioNodeEngine.h"
15 #include "nsAutoPtr.h"
17 namespace mozilla {
19 namespace dom {
21 class PeriodicWave MOZ_FINAL : public nsWrapperCache
22 {
23 public:
24 PeriodicWave(AudioContext* aContext,
25 const float* aRealData,
26 const float* aImagData,
27 const uint32_t aLength,
28 ErrorResult& aRv);
30 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PeriodicWave)
31 NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(PeriodicWave)
33 AudioContext* GetParentObject() const
34 {
35 return mContext;
36 }
38 virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
40 uint32_t DataLength() const
41 {
42 return mLength;
43 }
45 ThreadSharedFloatArrayBufferList* GetThreadSharedBuffer() const
46 {
47 return mCoefficients;
48 }
50 size_t SizeOfExcludingThisIfNotShared(MallocSizeOf aMallocSizeOf) const;
52 private:
53 nsRefPtr<AudioContext> mContext;
54 nsRefPtr<ThreadSharedFloatArrayBufferList> mCoefficients;
55 uint32_t mLength;
56 };
58 }
59 }
61 #endif