| 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
|
|
|