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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioWorkletNode.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
(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
9 #include "modules/webaudio/AudioNode.h"
10 #include "modules/webaudio/AudioParamMap.h"
11 #include "modules/webaudio/AudioWorkletProcessor.h"
12 #include "platform/wtf/PassRefPtr.h"
13 #include "platform/wtf/Threading.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&,
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 // To make it work, as a source node.
32 double TailTime() const override;
33 double LatencyTime() const override;
34
35 // This is used by AudioWorkletMessagingProxy to attach
36 // |AudioWorkletProcessor| instance to this handler.
37 void SetProcessorOnRenderingThread(AudioWorkletProcessor*);
38
39 private:
40 AudioWorkletHandler(AudioNode&, float sample_rate, String name);
41
42 UntracedMember<AudioWorkletProcessor> processor_;
43 HashMap<String, RefPtr<AudioParamHandler>> param_handler_map_;
44 };
45
46 class AudioWorkletNode final : public AudioNode,
47 public ActiveScriptWrappable<AudioWorkletNode> {
48 DEFINE_WRAPPERTYPEINFO();
49 USING_GARBAGE_COLLECTED_MIXIN(AudioWorkletNode);
50
51 public:
52 static AudioWorkletNode* Create(BaseAudioContext*,
53 const String& name,
54 ExceptionState&);
55
56 AudioParamMap* parameters() const;
57
58 // Called by handler to initialize AudioParamMap. This is only invoked when
59 // the node instantiation phase, and should never be used afterward.
60 void SetParameterMap(AudioParamMap*);
61
62 AudioWorkletHandler& GetWorkletHandler() const;
63
64 // ScriptWrappable
65 bool HasPendingActivity() const final;
66
67 DECLARE_VIRTUAL_TRACE();
68
69 private:
70 AudioWorkletNode(BaseAudioContext&, const String& name);
71
72 String name_;
73
74 Member<AudioParamMap> parameter_map_;
75 };
76
77 } // namespace blink
78
79 #endif // AudioWorkletNode_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698