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/V8BindingForCore.h" | 7 #include "bindings/core/v8/V8BindingForCore.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 "core/workers/WorkerClients.h" | 10 #include "core/workers/WorkerClients.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 void AudioWorklet::Initialize() { | 28 void AudioWorklet::Initialize() { |
29 AudioWorkletThread::EnsureSharedBackingThread(); | 29 AudioWorkletThread::EnsureSharedBackingThread(); |
30 | 30 |
31 DCHECK(!worklet_messaging_proxy_); | 31 DCHECK(!worklet_messaging_proxy_); |
32 DCHECK(GetExecutionContext()); | 32 DCHECK(GetExecutionContext()); |
33 | 33 |
34 WorkerClients* worker_clients = WorkerClients::Create(); | 34 WorkerClients* worker_clients = WorkerClients::Create(); |
35 worklet_messaging_proxy_ = | 35 worklet_messaging_proxy_ = |
36 new AudioWorkletMessagingProxy(GetExecutionContext(), worker_clients); | 36 new AudioWorkletMessagingProxy(GetExecutionContext(), worker_clients); |
37 worklet_messaging_proxy_->Initialize(); | 37 worklet_messaging_proxy_->Initialize(); |
| 38 |
| 39 is_initialized_ = true; |
38 } | 40 } |
39 | 41 |
40 bool AudioWorklet::IsInitialized() const { | 42 bool AudioWorklet::IsInitialized() const { |
41 return worklet_messaging_proxy_; | 43 return is_initialized_; |
42 } | 44 } |
43 | 45 |
44 WorkletGlobalScopeProxy* AudioWorklet::GetWorkletGlobalScopeProxy() const { | 46 WorkletGlobalScopeProxy* AudioWorklet::GetWorkletGlobalScopeProxy() const { |
45 DCHECK(worklet_messaging_proxy_); | 47 DCHECK(worklet_messaging_proxy_); |
46 return worklet_messaging_proxy_; | 48 return worklet_messaging_proxy_; |
47 } | 49 } |
48 | 50 |
49 DEFINE_TRACE(AudioWorklet) { | 51 DEFINE_TRACE(AudioWorklet) { |
50 ThreadedWorklet::Trace(visitor); | 52 ThreadedWorklet::Trace(visitor); |
51 } | 53 } |
52 | 54 |
53 } // namespace blink | 55 } // namespace blink |
OLD | NEW |