Chromium Code Reviews| 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..570760dd4a6ba6e409b880c54bb30c68c985801a |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletNode.h |
| @@ -0,0 +1,75 @@ |
| +// 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 "platform/wtf/PassRefPtr.h" |
| +#include "platform/wtf/Threading.h" |
| + |
| +#include "modules/webaudio/AudioWorkletProcessor.h" |
| +#include "modules/webaudio/AudioParamMap.h" |
| + |
| +namespace blink { |
| + |
| +class BaseAudioContext; |
| +class ExceptionState; |
| + |
| +class AudioWorkletHandler final : public AudioHandler { |
| + public: |
| + static PassRefPtr<AudioWorkletHandler> Create(AudioNode&, |
|
nhiroki
2017/06/07 14:43:52
PassRefPtr is deprecated. Can you use RefPtr?
|
| + float sample_rate, |
| + String name); |
| + |
| + ~AudioWorkletHandler() override; |
| + |
| + // AudioHandler |
| + void Process(size_t frames_to_process) override; |
| + |
| + void SetProcessor(AudioWorkletProcessor*); |
| + |
| + private: |
| + AudioWorkletHandler(AudioNode&, float sample_rate, String name); |
| + |
| + UntracedMember<AudioWorkletProcessor> processor_; |
| + |
| + HashMap<String, 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&); |
| + |
| + // JS interface. |
| + 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 AddAudioParam(const String& param_name, AudioParam*); |
| + |
| + 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 |