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

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

Issue 2793593002: AudioWorklet prototype
Patch Set: Merge changes, AudioParam bug fix Created 3 years, 5 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef AudioWorkletGlobalScope_h 5 #ifndef AudioWorkletGlobalScope_h
6 #define AudioWorkletGlobalScope_h 6 #define AudioWorkletGlobalScope_h
7 7
8 #include "bindings/core/v8/ScriptValue.h" 8 #include "bindings/core/v8/ScriptValue.h"
9 #include "core/dom/ExecutionContext.h" 9 #include "core/dom/ExecutionContext.h"
10 #include "core/workers/ThreadedWorkletGlobalScope.h" 10 #include "core/workers/ThreadedWorkletGlobalScope.h"
11 #include "modules/ModulesExport.h" 11 #include "modules/ModulesExport.h"
12 #include "platform/bindings/ScriptWrappable.h" 12 #include "platform/bindings/ScriptWrappable.h"
13 #include "platform/audio/AudioArray.h"
13 14
14 namespace blink { 15 namespace blink {
15 16
16 class AudioBuffer; 17 class AudioBuffer;
17 class AudioWorkletProcessor; 18 class AudioWorkletProcessor;
18 class AudioWorkletProcessorDefinition; 19 class AudioWorkletProcessorDefinition;
19 class ExceptionState; 20 class ExceptionState;
20 21
21 // This is constructed and destroyed on a worker thread, and all methods also 22 // This is constructed and destroyed on a worker thread, and all methods also
22 // must be called on the worker thread. 23 // must be called on the worker thread.
(...skipping 16 matching lines...) Expand all
39 40
40 // Creates an instance of AudioWorkletProcessor from a registered name. This 41 // Creates an instance of AudioWorkletProcessor from a registered name. This
41 // function may return nullptr when 1) a definition cannot be found or 2) a 42 // function may return nullptr when 1) a definition cannot be found or 2) a
42 // new V8 object cannot be constructed for some reason. 43 // new V8 object cannot be constructed for some reason.
43 AudioWorkletProcessor* CreateInstance(const String& name); 44 AudioWorkletProcessor* CreateInstance(const String& name);
44 45
45 // Invokes the JS audio processing function from an instance of 46 // Invokes the JS audio processing function from an instance of
46 // AudioWorkletProcessor, along with given AudioBuffer from the audio graph. 47 // AudioWorkletProcessor, along with given AudioBuffer from the audio graph.
47 bool Process(AudioWorkletProcessor*, 48 bool Process(AudioWorkletProcessor*,
48 AudioBuffer* input_buffer, 49 AudioBuffer* input_buffer,
49 AudioBuffer* output_buffer); 50 AudioBuffer* output_buffer,
51 HashMap<String, AudioFloatArray*> audio_param_data_map);
50 52
51 AudioWorkletProcessorDefinition* FindDefinition(const String& name); 53 AudioWorkletProcessorDefinition* FindDefinition(const String& name);
52 54
53 DECLARE_TRACE(); 55 DECLARE_TRACE();
54 DECLARE_TRACE_WRAPPERS(); 56 DECLARE_TRACE_WRAPPERS();
55 57
56 private: 58 private:
57 AudioWorkletGlobalScope(const KURL&, 59 AudioWorkletGlobalScope(const KURL&,
58 const String& user_agent, 60 const String& user_agent,
59 PassRefPtr<SecurityOrigin>, 61 PassRefPtr<SecurityOrigin>,
60 v8::Isolate*, 62 v8::Isolate*,
61 WorkerThread*, 63 WorkerThread*,
62 WorkerClients*); 64 WorkerClients*);
63 65
64 typedef HeapHashMap<String, 66 typedef HeapHashMap<String,
65 TraceWrapperMember<AudioWorkletProcessorDefinition>> 67 TraceWrapperMember<AudioWorkletProcessorDefinition>>
66 ProcessorDefinitionMap; 68 ProcessorDefinitionMap;
67 typedef HeapVector<TraceWrapperMember<AudioWorkletProcessor>> 69 typedef HeapVector<TraceWrapperMember<AudioWorkletProcessor>>
68 ProcessorInstances; 70 ProcessorInstances;
69 71
70 ProcessorDefinitionMap processor_definition_map_; 72 ProcessorDefinitionMap processor_definition_map_;
71 ProcessorInstances processor_instances_; 73 ProcessorInstances processor_instances_;
72 }; 74 };
73 75
76 DEFINE_TYPE_CASTS(AudioWorkletGlobalScope,
77 ExecutionContext,
78 context,
79 context->IsAudioWorkletGlobalScope(),
80 context.IsAudioWorkletGlobalScope());
81
74 } // namespace blink 82 } // namespace blink
75 83
76 #endif // AudioWorkletGlobalScope_h 84 #endif // AudioWorkletGlobalScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698