Index: third_party/WebKit/Source/modules/webaudio/AudioWorkletNode.h |
diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletNode.h b/third_party/WebKit/Source/modules/webaudio/AudioWorkletNode.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..da45d21da4b5dc68cd3cc97b5776705af3aa499f |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletNode.h |
@@ -0,0 +1,79 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef AudioWorkletNode_h |
+#define AudioWorkletNode_h |
+ |
+ |
+#include "modules/webaudio/AudioNode.h" |
+#include "modules/webaudio/AudioParamMap.h" |
+#include "modules/webaudio/AudioWorkletProcessor.h" |
+#include "platform/wtf/PassRefPtr.h" |
+#include "platform/wtf/Threading.h" |
+ |
+namespace blink { |
+ |
+class BaseAudioContext; |
+class ExceptionState; |
+ |
+class AudioWorkletHandler final : public AudioHandler { |
+ public: |
+ static PassRefPtr<AudioWorkletHandler> Create(AudioNode&, |
+ float sample_rate, |
+ String name); |
+ |
+ ~AudioWorkletHandler() override; |
+ |
+ // AudioHandler |
+ void Process(size_t frames_to_process) override; |
+ |
+ // To make it work, as a source node. |
+ double TailTime() const override; |
+ double LatencyTime() const override; |
+ |
+ // This is used by AudioWorkletMessagingProxy to attach |
+ // |AudioWorkletProcessor| instance to this handler. |
+ void SetProcessorOnRenderingThread(AudioWorkletProcessor*); |
+ |
+ private: |
+ AudioWorkletHandler(AudioNode&, float sample_rate, String name); |
+ |
+ UntracedMember<AudioWorkletProcessor> processor_; |
+ HashMap<String, RefPtr<AudioParamHandler>> param_handler_map_; |
+}; |
+ |
+class AudioWorkletNode final : public AudioNode, |
+ public ActiveScriptWrappable<AudioWorkletNode> { |
+ DEFINE_WRAPPERTYPEINFO(); |
+ USING_GARBAGE_COLLECTED_MIXIN(AudioWorkletNode); |
+ |
+ public: |
+ static AudioWorkletNode* Create(BaseAudioContext*, |
+ const String& name, |
+ ExceptionState&); |
+ |
+ AudioParamMap* parameters() const; |
+ |
+ // Called by handler to initialize AudioParamMap. This is only invoked when |
+ // the node instantiation phase, and should never be used afterward. |
+ void SetParameterMap(AudioParamMap*); |
+ |
+ AudioWorkletHandler& GetWorkletHandler() const; |
+ |
+ // ScriptWrappable |
+ bool HasPendingActivity() const final; |
+ |
+ DECLARE_VIRTUAL_TRACE(); |
+ |
+ private: |
+ AudioWorkletNode(BaseAudioContext&, const String& name); |
+ |
+ String name_; |
+ |
+ Member<AudioParamMap> parameter_map_; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // AudioWorkletNode_h |