OLD | NEW |
---|---|
(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 AudioWorkletNode_h | |
6 #define AudioWorkletNode_h | |
7 | |
8 #include "modules/webaudio/AudioNode.h" | |
9 #include "platform/wtf/PassRefPtr.h" | |
10 #include "platform/wtf/Threading.h" | |
11 | |
12 #include "modules/webaudio/AudioWorkletProcessor.h" | |
13 #include "modules/webaudio/AudioParamMap.h" | |
14 | |
15 namespace blink { | |
16 | |
17 class BaseAudioContext; | |
18 class ExceptionState; | |
19 | |
20 class AudioWorkletHandler final : public AudioHandler { | |
21 public: | |
22 static PassRefPtr<AudioWorkletHandler> Create(AudioNode&, | |
nhiroki
2017/06/07 14:43:52
PassRefPtr is deprecated. Can you use RefPtr?
| |
23 float sample_rate, | |
24 String name); | |
25 | |
26 ~AudioWorkletHandler() override; | |
27 | |
28 // AudioHandler | |
29 void Process(size_t frames_to_process) override; | |
30 | |
31 void SetProcessor(AudioWorkletProcessor*); | |
32 | |
33 private: | |
34 AudioWorkletHandler(AudioNode&, float sample_rate, String name); | |
35 | |
36 UntracedMember<AudioWorkletProcessor> processor_; | |
37 | |
38 HashMap<String, AudioParamHandler*> param_handler_map_; | |
39 }; | |
40 | |
41 class AudioWorkletNode final : public AudioNode, | |
42 public ActiveScriptWrappable<AudioWorkletNode> { | |
43 DEFINE_WRAPPERTYPEINFO(); | |
44 USING_GARBAGE_COLLECTED_MIXIN(AudioWorkletNode); | |
45 | |
46 public: | |
47 static AudioWorkletNode* Create(BaseAudioContext*, | |
48 const String& name, | |
49 ExceptionState&); | |
50 | |
51 // JS interface. | |
52 AudioParamMap* parameters() const; | |
53 | |
54 // Called by handler to initialize AudioParamMap. This is only invoked when | |
55 // the node instantiation phase, and should never be used afterward. | |
56 // void AddAudioParam(const String& param_name, AudioParam*); | |
57 | |
58 AudioWorkletHandler& GetWorkletHandler() const; | |
59 | |
60 // ScriptWrappable | |
61 bool HasPendingActivity() const final; | |
62 | |
63 DECLARE_VIRTUAL_TRACE(); | |
64 | |
65 private: | |
66 AudioWorkletNode(BaseAudioContext&, const String& name); | |
67 | |
68 String name_; | |
69 | |
70 Member<AudioParamMap> parameter_map_; | |
71 }; | |
72 | |
73 } // namespace blink | |
74 | |
75 #endif // AudioWorkletNode_h | |
OLD | NEW |