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

Unified Diff: third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp

Issue 1960533003: [DO NOT SUBMIT] AudioWorklet FS1: importing scripts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp
diff --git a/third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp b/third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..97d3836488d2e917460c8213142dd6ec6ce11f96
--- /dev/null
+++ b/third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp
@@ -0,0 +1,56 @@
+// 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.
+
+#include "modules/webaudio/WindowAudioWorklet.h"
+
+#include "core/frame/LocalDOMWindow.h"
+#include "core/frame/LocalFrame.h"
+#include "modules/webaudio/AudioWorklet.h"
+
+namespace blink {
+
+WindowAudioWorklet::WindowAudioWorklet(LocalDOMWindow& window)
+ : DOMWindowProperty(window.frame())
+{
+}
+
+const char* WindowAudioWorklet::supplementName()
+{
+ return "WindowAudioWorklet";
+}
+
+// static
+WindowAudioWorklet& WindowAudioWorklet::from(LocalDOMWindow& window)
+{
+ WindowAudioWorklet* supplement = static_cast<WindowAudioWorklet*>(Supplement<LocalDOMWindow>::from(window, supplementName()));
+ if (!supplement) {
+ supplement = new WindowAudioWorklet(window);
+ provideTo(window, supplementName(), supplement);
+ }
+ return *supplement;
+}
+
+// static
+// TODO: why this returns Worklet*? This seems to be the connection to the
+// window name space.
+Worklet* WindowAudioWorklet::audioWorklet(ExecutionContext* executionContext, DOMWindow& window)
+{
+ return from(toLocalDOMWindow(window)).audioWorklet(executionContext);
+}
+
+AudioWorklet* WindowAudioWorklet::audioWorklet(ExecutionContext* executionContext) const
+{
+ if (!m_audioWorklet && frame())
+ m_audioWorklet = AudioWorklet::create(frame(), executionContext);
+ return m_audioWorklet.get();
+}
+
+DEFINE_TRACE(WindowAudioWorklet)
+{
+ visitor->trace(m_audioWorklet);
+ Supplement<LocalDOMWindow>::trace(visitor);
+ DOMWindowProperty::trace(visitor);
+}
+
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698