Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" | |
| 9 #include "core/dom/ExecutionContext.h" | |
| 8 #include "core/workers/ThreadedWorkletGlobalScope.h" | 10 #include "core/workers/ThreadedWorkletGlobalScope.h" |
| 11 #include "modules/ModulesExport.h" | |
| 9 | 12 |
| 10 namespace blink { | 13 namespace blink { |
| 11 | 14 |
| 12 class AudioWorkletGlobalScope final : public ThreadedWorkletGlobalScope { | 15 class ExceptionState; |
| 16 class AudioBuffer; | |
| 17 class AudioWorkletProcessor; | |
| 18 class AudioWorkletProcessorDefinition; | |
| 19 | |
| 20 // This is constructed and destroyed on a worker thread, and all methods also | |
| 21 // must be called on the worker thread. | |
| 22 class MODULES_EXPORT AudioWorkletGlobalScope final | |
| 23 : public ThreadedWorkletGlobalScope { | |
| 13 DEFINE_WRAPPERTYPEINFO(); | 24 DEFINE_WRAPPERTYPEINFO(); |
| 14 | 25 |
| 15 public: | 26 public: |
| 16 static AudioWorkletGlobalScope* create(const KURL&, | 27 static AudioWorkletGlobalScope* create(const KURL&, |
| 17 const String& userAgent, | 28 const String& userAgent, |
| 18 PassRefPtr<SecurityOrigin>, | 29 PassRefPtr<SecurityOrigin>, |
| 19 v8::Isolate*, | 30 v8::Isolate*, |
| 20 WorkerThread*); | 31 WorkerThread*); |
| 21 ~AudioWorkletGlobalScope() override; | 32 ~AudioWorkletGlobalScope() override; |
| 33 void dispose() final; | |
| 34 bool isAudioWorkletGlobalScope() const final { return true; } | |
| 35 void registerProcessor(ScriptState*, | |
| 36 const String& name, | |
| 37 const ScriptValue& classDefinition, | |
| 38 ExceptionState&); | |
| 39 | |
| 40 // Create an instance of AudioWorkletProcessor from a registered name. | |
|
nhiroki
2017/03/10 15:30:13
s/Create/Creates/
Can you mention this function m
hongchan
2017/03/15 22:30:18
Done.
| |
| 41 AudioWorkletProcessor* createInstance(const String& name); | |
| 42 | |
| 43 bool process(AudioWorkletProcessor*, | |
| 44 AudioBuffer* inputBuffer, | |
| 45 AudioBuffer* outputBuffer); | |
| 46 | |
| 47 AudioWorkletProcessorDefinition* findDefinition(const String& name); | |
|
nhiroki
2017/03/10 15:30:13
Can you move this to the "private" section?
hongchan
2017/03/15 22:30:18
I ended up using this method in the testing. If yo
| |
| 48 | |
| 49 DECLARE_TRACE(); | |
| 22 | 50 |
| 23 private: | 51 private: |
| 24 AudioWorkletGlobalScope(const KURL&, | 52 AudioWorkletGlobalScope(const KURL&, |
| 25 const String& userAgent, | 53 const String& userAgent, |
| 26 PassRefPtr<SecurityOrigin>, | 54 PassRefPtr<SecurityOrigin>, |
| 27 v8::Isolate*, | 55 v8::Isolate*, |
| 28 WorkerThread*); | 56 WorkerThread*); |
| 57 | |
| 58 typedef HeapHashMap<String, Member<AudioWorkletProcessorDefinition>> | |
| 59 ProcessorDefinitionMap; | |
| 60 typedef HeapVector<Member<AudioWorkletProcessor>> ProcessorInstances; | |
| 61 | |
| 62 ProcessorDefinitionMap m_processorDefinitionMap; | |
| 63 ProcessorInstances m_processorInstances; | |
| 29 }; | 64 }; |
| 30 | 65 |
| 31 } // namespace blink | 66 } // namespace blink |
| 32 | 67 |
| 33 #endif // AudioWorkletGlobalScope_h | 68 #endif // AudioWorkletGlobalScope_h |
| OLD | NEW |