| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/webaudio/AudioWorklet.h" | 5 #include "modules/webaudio/AudioWorklet.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/V8Binding.h" | 7 #include "bindings/core/v8/V8Binding.h" |
| 8 #include "core/dom/Document.h" | 8 #include "core/dom/Document.h" |
| 9 #include "core/frame/LocalFrame.h" | 9 #include "core/frame/LocalFrame.h" |
| 10 #include "modules/webaudio/AudioWorkletMessagingProxy.h" | 10 #include "modules/webaudio/AudioWorkletMessagingProxy.h" |
| 11 #include "modules/webaudio/AudioWorkletThread.h" | 11 #include "modules/webaudio/AudioWorkletThread.h" |
| 12 | 12 |
| 13 namespace blink { | 13 namespace blink { |
| 14 | 14 |
| 15 AudioWorklet* AudioWorklet::create(LocalFrame* frame) { | 15 AudioWorklet* AudioWorklet::create(LocalFrame* frame) { |
| 16 AudioWorklet* worklet = new AudioWorklet(frame); | 16 return new AudioWorklet(frame); |
| 17 worklet->suspendIfNeeded(); | |
| 18 return worklet; | |
| 19 } | 17 } |
| 20 | 18 |
| 21 AudioWorklet::AudioWorklet(LocalFrame* frame) | 19 AudioWorklet::AudioWorklet(LocalFrame* frame) |
| 22 : Worklet(frame), m_workletMessagingProxy(nullptr) {} | 20 : Worklet(frame), m_workletMessagingProxy(nullptr) {} |
| 23 | 21 |
| 24 AudioWorklet::~AudioWorklet() { | 22 AudioWorklet::~AudioWorklet() { |
| 25 if (m_workletMessagingProxy) | 23 if (m_workletMessagingProxy) |
| 26 m_workletMessagingProxy->parentObjectDestroyed(); | 24 m_workletMessagingProxy->parentObjectDestroyed(); |
| 27 } | 25 } |
| 28 | 26 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 44 WorkletGlobalScopeProxy* AudioWorklet::workletGlobalScopeProxy() const { | 42 WorkletGlobalScopeProxy* AudioWorklet::workletGlobalScopeProxy() const { |
| 45 DCHECK(m_workletMessagingProxy); | 43 DCHECK(m_workletMessagingProxy); |
| 46 return m_workletMessagingProxy; | 44 return m_workletMessagingProxy; |
| 47 } | 45 } |
| 48 | 46 |
| 49 DEFINE_TRACE(AudioWorklet) { | 47 DEFINE_TRACE(AudioWorklet) { |
| 50 Worklet::trace(visitor); | 48 Worklet::trace(visitor); |
| 51 } | 49 } |
| 52 | 50 |
| 53 } // namespace blink | 51 } // namespace blink |
| OLD | NEW |