| 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
|
| index 4aa08ad30d7841caab43cbab65828947d2b76d68..b19ebadbd868866c6e25e0369de668fd8a8f6566 100644
|
| --- a/third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp
|
| +++ b/third_party/WebKit/Source/modules/webaudio/WindowAudioWorklet.cpp
|
| @@ -7,43 +7,18 @@
|
| #include "core/dom/Document.h"
|
| #include "core/frame/LocalDOMWindow.h"
|
| #include "core/frame/LocalFrame.h"
|
| -#include "modules/webaudio/AudioWorklet.h"
|
|
|
| namespace blink {
|
|
|
| -WindowAudioWorklet::WindowAudioWorklet(LocalDOMWindow& window)
|
| - : ContextLifecycleObserver(window.frame()->document()) {}
|
| -
|
| -const char* WindowAudioWorklet::supplementName() {
|
| - return "WindowAudioWorklet";
|
| -}
|
| -
|
| -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;
|
| -}
|
| -
|
| -Worklet* WindowAudioWorklet::audioWorklet(DOMWindow& window) {
|
| +AudioWorklet* WindowAudioWorklet::audioWorklet(LocalDOMWindow& window) {
|
| if (!window.frame())
|
| return nullptr;
|
| - return from(toLocalDOMWindow(window)).audioWorklet(toLocalDOMWindow(window));
|
| -}
|
| -
|
| -AudioWorklet* WindowAudioWorklet::audioWorklet(LocalDOMWindow& window) {
|
| - if (!m_audioWorklet && getExecutionContext()) {
|
| - DCHECK(window.frame());
|
| - m_audioWorklet = AudioWorklet::create(window.frame());
|
| - }
|
| - return m_audioWorklet.get();
|
| + return from(window).m_audioWorklet.get();
|
| }
|
|
|
| // Break the following cycle when the context gets detached.
|
| // Otherwise, the worklet object will leak.
|
| +// TODO(dcheng): Why isn't this just all on the Oilpan heap?
|
| //
|
| // window => window.audioWorklet
|
| // => WindowAudioWorklet
|
| @@ -61,4 +36,22 @@ DEFINE_TRACE(WindowAudioWorklet) {
|
| ContextLifecycleObserver::trace(visitor);
|
| }
|
|
|
| +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;
|
| +}
|
| +
|
| +WindowAudioWorklet::WindowAudioWorklet(LocalDOMWindow& window)
|
| + : ContextLifecycleObserver(window.frame()->document()),
|
| + m_audioWorklet(AudioWorklet::create(window.frame())) {}
|
| +
|
| +const char* WindowAudioWorklet::supplementName() {
|
| + return "WindowAudioWorklet";
|
| +}
|
| +
|
| } // namespace blink
|
|
|