Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioWorkletProcessor.cpp

Issue 2903703003: Use wrapper tracing for worklets. (Closed)
Patch Set: Separating in two CLs Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/AudioWorkletProcessor.h" 5 #include "modules/webaudio/AudioWorkletProcessor.h"
6 6
7 #include "modules/webaudio/AudioWorkletGlobalScope.h" 7 #include "modules/webaudio/AudioWorkletGlobalScope.h"
8 8
9 namespace blink { 9 namespace blink {
10 10
11 // This static factory should be called after an instance of |AudioWorkletNode| 11 // This static factory should be called after an instance of |AudioWorkletNode|
12 // gets created by user-supplied JS code in the main thread. This factory must 12 // gets created by user-supplied JS code in the main thread. This factory must
13 // not be called by user in |AudioWorkletGlobalScope|. 13 // not be called by user in |AudioWorkletGlobalScope|.
14 AudioWorkletProcessor* AudioWorkletProcessor::Create( 14 AudioWorkletProcessor* AudioWorkletProcessor::Create(
15 AudioWorkletGlobalScope* global_scope, 15 AudioWorkletGlobalScope* global_scope,
16 const String& name) { 16 const String& name) {
17 DCHECK(!IsMainThread()); 17 DCHECK(!IsMainThread());
18 DCHECK(global_scope); 18 DCHECK(global_scope);
19 return new AudioWorkletProcessor(global_scope, name); 19 return new AudioWorkletProcessor(global_scope, name);
20 } 20 }
21 21
22 AudioWorkletProcessor::AudioWorkletProcessor( 22 AudioWorkletProcessor::AudioWorkletProcessor(
23 AudioWorkletGlobalScope* global_scope, 23 AudioWorkletGlobalScope* global_scope,
24 const String& name) 24 const String& name)
25 : global_scope_(global_scope), name_(name) {} 25 : global_scope_(global_scope), name_(name), instance_(this) {}
26 26
27 AudioWorkletProcessor::~AudioWorkletProcessor() {} 27 AudioWorkletProcessor::~AudioWorkletProcessor() {}
28 28
29 void AudioWorkletProcessor::SetInstance(v8::Isolate* isolate, 29 void AudioWorkletProcessor::SetInstance(v8::Isolate* isolate,
30 v8::Local<v8::Object> instance) { 30 v8::Local<v8::Object> instance) {
31 DCHECK(global_scope_->IsContextThread()); 31 DCHECK(global_scope_->IsContextThread());
32 instance_.Set(isolate, instance); 32 instance_.Set(isolate, instance);
33 } 33 }
34 34
35 v8::Local<v8::Object> AudioWorkletProcessor::InstanceLocal( 35 v8::Local<v8::Object> AudioWorkletProcessor::InstanceLocal(
36 v8::Isolate* isolate) { 36 v8::Isolate* isolate) {
37 DCHECK(global_scope_->IsContextThread()); 37 DCHECK(global_scope_->IsContextThread());
38 return instance_.NewLocal(isolate); 38 return instance_.NewLocal(isolate);
39 } 39 }
40 40
41 void AudioWorkletProcessor::Process(AudioBuffer* input_buffer, 41 void AudioWorkletProcessor::Process(AudioBuffer* input_buffer,
42 AudioBuffer* output_buffer) { 42 AudioBuffer* output_buffer) {
43 DCHECK(global_scope_->IsContextThread()); 43 DCHECK(global_scope_->IsContextThread());
44 global_scope_->Process(this, input_buffer, output_buffer); 44 global_scope_->Process(this, input_buffer, output_buffer);
45 } 45 }
46 46
47 DEFINE_TRACE(AudioWorkletProcessor) { 47 DEFINE_TRACE(AudioWorkletProcessor) {
48 visitor->Trace(global_scope_); 48 visitor->Trace(global_scope_);
49 } 49 }
50 50
51 DEFINE_TRACE_WRAPPERS(AudioWorkletProcessor) {
52 visitor->TraceWrappers(instance_.Cast<v8::Value>());
53 }
54
51 } // namespace blink 55 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698