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 return new AudioWorklet(frame); | 16 return new AudioWorklet(frame); |
17 } | 17 } |
18 | 18 |
19 AudioWorklet::AudioWorklet(LocalFrame* frame) | 19 AudioWorklet::AudioWorklet(LocalFrame* frame) |
20 : Worklet(frame), worklet_messaging_proxy_(nullptr) {} | 20 : ThreadedWorklet(frame), worklet_messaging_proxy_(nullptr) {} |
21 | 21 |
22 AudioWorklet::~AudioWorklet() { | 22 AudioWorklet::~AudioWorklet() { |
23 if (worklet_messaging_proxy_) | 23 if (worklet_messaging_proxy_) |
24 worklet_messaging_proxy_->ParentObjectDestroyed(); | 24 worklet_messaging_proxy_->ParentObjectDestroyed(); |
25 } | 25 } |
26 | 26 |
27 void AudioWorklet::Initialize() { | 27 void AudioWorklet::Initialize() { |
28 AudioWorkletThread::EnsureSharedBackingThread(); | 28 AudioWorkletThread::EnsureSharedBackingThread(); |
29 | 29 |
30 DCHECK(!worklet_messaging_proxy_); | 30 DCHECK(!worklet_messaging_proxy_); |
31 DCHECK(GetExecutionContext()); | 31 DCHECK(GetExecutionContext()); |
32 | 32 |
33 worklet_messaging_proxy_ = | 33 worklet_messaging_proxy_ = |
34 new AudioWorkletMessagingProxy(GetExecutionContext()); | 34 new AudioWorkletMessagingProxy(GetExecutionContext()); |
35 worklet_messaging_proxy_->Initialize(); | 35 worklet_messaging_proxy_->Initialize(); |
36 } | 36 } |
37 | 37 |
38 bool AudioWorklet::IsInitialized() const { | 38 bool AudioWorklet::IsInitialized() const { |
39 return worklet_messaging_proxy_; | 39 return worklet_messaging_proxy_; |
40 } | 40 } |
41 | 41 |
42 WorkletGlobalScopeProxy* AudioWorklet::GetWorkletGlobalScopeProxy() const { | 42 WorkletGlobalScopeProxy* AudioWorklet::GetWorkletGlobalScopeProxy() const { |
43 DCHECK(worklet_messaging_proxy_); | 43 DCHECK(worklet_messaging_proxy_); |
44 return worklet_messaging_proxy_; | 44 return worklet_messaging_proxy_; |
45 } | 45 } |
46 | 46 |
47 DEFINE_TRACE(AudioWorklet) { | 47 DEFINE_TRACE(AudioWorklet) { |
48 Worklet::Trace(visitor); | 48 ThreadedWorklet::Trace(visitor); |
49 } | 49 } |
50 | 50 |
51 } // namespace blink | 51 } // namespace blink |
OLD | NEW |