Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessorDefinition.h

Issue 2727733002: Implement AudioWorkletProcessor interface (Closed)
Patch Set: Addressing feedback Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef AudioWorkletProcessorDefinition_h
6 #define AudioWorkletProcessorDefinition_h
7
8 #include "bindings/core/v8/ScopedPersistent.h"
9 #include "platform/heap/Handle.h"
10 #include "v8/include/v8.h"
11
12 namespace blink {
13
14 class AudioBuffer;
15 class ScriptState;
16
17 // Represents a JavaScript class definition registered in the
18 // AudioWorkletGlobalScope. After the registration, a definition class contains
19 // the V8 representation of class components (constructor, process callback,
20 // prototypes and parameter descriptors).
21 //
22 // This is constructed and destroyed on a worker thread, and all methods also
23 // must be called on the worker thread.
24 class AudioWorkletProcessorDefinition final
25 : public GarbageCollectedFinalized<AudioWorkletProcessorDefinition> {
26 public:
27 static AudioWorkletProcessorDefinition* create(
28 ScriptState*,
29 v8::Local<v8::Function> constructor,
30 v8::Local<v8::Function> process);
31
32 virtual ~AudioWorkletProcessorDefinition();
33
34 // Create a V8 object instance of |AudioWorkletProcessor| from the definition.
35 void createInstance(ScopedPersistent<v8::Object>& instance);
36
37 // Perform process() call with an |AudioWorkletProcessor| instance.
38 bool process(ScopedPersistent<v8::Object>& instance,
39 AudioBuffer* inputBuffer,
40 AudioBuffer* outputBuffer);
41
42 ScriptState* getScriptState() const { return m_scriptState.get(); }
43
44 DEFINE_INLINE_TRACE(){};
45
46 private:
47 AudioWorkletProcessorDefinition(ScriptState*,
48 v8::Local<v8::Function> constructor,
49 v8::Local<v8::Function> process);
50
51 RefPtr<ScriptState> m_scriptState;
52
53 // The definition is per global scope. The active instance of
54 // |AudioProcessorWorklet| should be passed into these to perform JS function.
55 ScopedPersistent<v8::Function> m_constructor;
56 ScopedPersistent<v8::Function> m_process;
haraken 2017/03/08 09:57:19 Just to confirm: You're intending to keep these ob
hongchan 2017/03/08 19:38:46 Correct. This definition is owned by AWGS and it i
57
58 // TODO(hongchan): A container for AudioParamDescriptor objects.
59 // ScopedPersistent<v8::Array> m_parameterDescriptors;
60 };
61
62 } // namespace blink
63
64 #endif // AudioWorkletProcessorDefinition_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698