AudioWorkletProcessor.h (1428B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 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 https://mozilla.org/MPL/2.0/. */ 6 7 #ifndef AudioWorkletProcessor_h_ 8 #define AudioWorkletProcessor_h_ 9 10 #include "nsCOMPtr.h" 11 #include "nsWrapperCache.h" 12 13 class nsIGlobalObject; 14 15 namespace mozilla { 16 17 class ErrorResult; 18 19 namespace dom { 20 21 struct AudioWorkletNodeOptions; 22 class GlobalObject; 23 class MessagePort; 24 25 class AudioWorkletProcessor final : public nsWrapperCache { 26 public: 27 NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AudioWorkletProcessor) 28 NS_DECL_CYCLE_COLLECTION_NATIVE_WRAPPERCACHE_CLASS(AudioWorkletProcessor) 29 30 static already_AddRefed<AudioWorkletProcessor> Constructor( 31 const GlobalObject& aGlobal, ErrorResult& aRv); 32 33 nsIGlobalObject* GetParentObject() const { return mParent; } 34 35 JSObject* WrapObject(JSContext* aCx, 36 JS::Handle<JSObject*> aGivenProto) override; 37 38 MessagePort* Port() const { return mPort; }; 39 40 private: 41 explicit AudioWorkletProcessor(nsIGlobalObject* aParent, MessagePort* aPort); 42 ~AudioWorkletProcessor(); 43 nsCOMPtr<nsIGlobalObject> mParent; 44 RefPtr<MessagePort> mPort; 45 }; 46 47 } // namespace dom 48 } // namespace mozilla 49 50 #endif // AudioWorkletProcessor_h_