summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/modules/webaudio/audio_worklet.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-15 10:20:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-15 10:28:57 +0000
commitd17ea114e5ef69ad5d5d7413280a13e6428098aa (patch)
tree2c01a75df69f30d27b1432467cfe7c1467a498da /chromium/third_party/blink/renderer/modules/webaudio/audio_worklet.h
parent8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (diff)
downloadqtwebengine-chromium-d17ea114e5ef69ad5d5d7413280a13e6428098aa.tar.gz
BASELINE: Update Chromium to 67.0.3396.47
Change-Id: Idcb1341782e417561a2473eeecc82642dafda5b7 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/webaudio/audio_worklet.h')
-rw-r--r--chromium/third_party/blink/renderer/modules/webaudio/audio_worklet.h74
1 files changed, 74 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/modules/webaudio/audio_worklet.h b/chromium/third_party/blink/renderer/modules/webaudio/audio_worklet.h
new file mode 100644
index 00000000000..98b6c4672da
--- /dev/null
+++ b/chromium/third_party/blink/renderer/modules/webaudio/audio_worklet.h
@@ -0,0 +1,74 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_AUDIO_WORKLET_H_
+#define THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_AUDIO_WORKLET_H_
+
+#include "third_party/blink/renderer/core/workers/worklet.h"
+#include "third_party/blink/renderer/modules/modules_export.h"
+#include "third_party/blink/renderer/platform/heap/handle.h"
+
+namespace blink {
+
+class AudioWorkletHandler;
+class AudioWorkletMessagingProxy;
+class BaseAudioContext;
+class CrossThreadAudioParamInfo;
+class MessagePortChannel;
+class SerializedScriptValue;
+
+class MODULES_EXPORT AudioWorklet final : public Worklet {
+ DEFINE_WRAPPERTYPEINFO();
+ USING_GARBAGE_COLLECTED_MIXIN(AudioWorklet);
+ WTF_MAKE_NONCOPYABLE(AudioWorklet);
+
+ public:
+ // When the AudioWorklet runtime flag is not enabled, this constructor returns
+ // |nullptr|.
+ static AudioWorklet* Create(BaseAudioContext*);
+
+ ~AudioWorklet() = default;
+
+ void CreateProcessor(AudioWorkletHandler*,
+ MessagePortChannel,
+ scoped_refptr<SerializedScriptValue> node_options);
+
+ // Invoked by AudioWorkletMessagingProxy. Notifies |context_| when
+ // AudioWorkletGlobalScope finishes the first script evaluation and is ready
+ // for the worklet operation. Can be used for other post-evaluation tasks
+ // in AudioWorklet or BaseAudioContext.
+ void NotifyGlobalScopeIsUpdated();
+
+ BaseAudioContext* GetBaseAudioContext() const;
+
+ // Returns |nullptr| if there is no active WorkletGlobalScope().
+ AudioWorkletMessagingProxy* GetMessagingProxy();
+
+ const Vector<CrossThreadAudioParamInfo> GetParamInfoListForProcessor(
+ const String& name);
+
+ bool IsProcessorRegistered(const String& name);
+
+ // Returns |true| when a AudioWorkletMessagingProxy and a WorkletBackingThread
+ // are ready.
+ bool IsReady();
+
+ void Trace(blink::Visitor*) override;
+
+ private:
+ explicit AudioWorklet(BaseAudioContext*);
+
+ // Implements Worklet
+ bool NeedsToCreateGlobalScope() final;
+ WorkletGlobalScopeProxy* CreateGlobalScope() final;
+
+ // To catch the first global scope update and notify the context.
+ bool worklet_started_ = false;
+
+ Member<BaseAudioContext> context_;
+};
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_RENDERER_MODULES_WEBAUDIO_AUDIO_WORKLET_H_