Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.h |
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.h b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a4e44bc53daf62011c9f4c09f0a868b6ab61a6d2 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.h |
| @@ -0,0 +1,53 @@ |
| +// 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 AudioWorkletProcessor_h |
| +#define AudioWorkletProcessor_h |
| + |
| +#include "bindings/core/v8/ScopedPersistent.h" |
| +#include "platform/heap/Handle.h" |
| +#include "v8/include/v8.h" |
| +#include "wtf/text/WTFString.h" |
| + |
| +namespace blink { |
| + |
| +class AudioBuffer; |
| +class AudioWorkletGlobalScope; |
| +class AudioWorkletProcessorDefinition; |
| + |
| +// AudioWorkletProcessor class represents the active instance created from |
| +// AudioWorkletProcessorDefinition. |AudioWorkletNodeHandler| invokes |
| +// process() method in this object upon graph rendering. |
| +// |
| +// This is constructed and destroyed on a worker thread, and all methods also |
| +// must be called on the worker thread. |
|
haraken
2017/03/10 13:43:22
Can you add DCHECK(!isMainThread) for documentatio
hongchan
2017/03/15 22:30:18
Done.
|
| +class AudioWorkletProcessor |
| + : public GarbageCollectedFinalized<AudioWorkletProcessor> { |
| + public: |
| + static AudioWorkletProcessor* create(AudioWorkletGlobalScope*, |
| + const String& name); |
| + virtual ~AudioWorkletProcessor(); |
| + |
| + void setInstance(v8::Isolate*, v8::Local<v8::Object> instance); |
| + |
| + v8::Local<v8::Object> instanceLocal(v8::Isolate*); |
| + |
| + // |AudioWorkletHandler| invokes this method to process audio. |
| + void process(AudioBuffer* inputBuffer, AudioBuffer* outputBuffer); |
| + |
| + const String& name() const { return m_name; } |
| + |
| + DECLARE_TRACE(); |
| + |
| + private: |
| + explicit AudioWorkletProcessor(AudioWorkletGlobalScope*, const String& name); |
|
nhiroki
2017/03/10 15:30:13
Can you remove 'explicit'?
hongchan
2017/03/15 22:30:18
Done.
|
| + |
| + Member<AudioWorkletGlobalScope> m_globalScope; |
| + String m_name; |
| + ScopedPersistent<v8::Object> m_instance; |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // AudioWorkletProcessor_h |