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

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

Issue 2840473002: Worker: Remove WorkerLoaderProxy for clean-up (Closed)
Patch Set: wip Created 3 years, 7 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 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/AudioWorkletThread.h" 5 #include "modules/webaudio/AudioWorkletThread.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include "core/workers/WorkerBackingThread.h" 8 #include "core/workers/WorkerBackingThread.h"
9 #include "core/workers/WorkerThreadStartupData.h" 9 #include "core/workers/WorkerThreadStartupData.h"
10 #include "modules/webaudio/AudioWorkletGlobalScope.h" 10 #include "modules/webaudio/AudioWorkletGlobalScope.h"
11 #include "platform/CrossThreadFunctional.h" 11 #include "platform/CrossThreadFunctional.h"
12 #include "platform/WaitableEvent.h" 12 #include "platform/WaitableEvent.h"
13 #include "platform/WebThreadSupportingGC.h" 13 #include "platform/WebThreadSupportingGC.h"
14 #include "platform/instrumentation/tracing/TraceEvent.h" 14 #include "platform/instrumentation/tracing/TraceEvent.h"
15 #include "platform/weborigin/SecurityOrigin.h" 15 #include "platform/weborigin/SecurityOrigin.h"
16 #include "platform/wtf/Assertions.h" 16 #include "platform/wtf/Assertions.h"
17 #include "platform/wtf/PtrUtil.h" 17 #include "platform/wtf/PtrUtil.h"
18 #include "public/platform/Platform.h" 18 #include "public/platform/Platform.h"
19 19
20 namespace blink { 20 namespace blink {
21 21
22 template class WorkletThreadHolder<AudioWorkletThread>; 22 template class WorkletThreadHolder<AudioWorkletThread>;
23 23
24 std::unique_ptr<AudioWorkletThread> AudioWorkletThread::Create( 24 std::unique_ptr<AudioWorkletThread> AudioWorkletThread::Create(
25 PassRefPtr<WorkerLoaderProxy> worker_loader_proxy, 25 ThreadableLoadingContext* loading_context,
26 WorkerReportingProxy& worker_reporting_proxy) { 26 WorkerReportingProxy& worker_reporting_proxy) {
27 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("audio-worklet"), 27 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("audio-worklet"),
28 "AudioWorkletThread::create"); 28 "AudioWorkletThread::create");
29 DCHECK(IsMainThread()); 29 DCHECK(IsMainThread());
30 return WTF::WrapUnique(new AudioWorkletThread(std::move(worker_loader_proxy), 30 return WTF::WrapUnique(
31 worker_reporting_proxy)); 31 new AudioWorkletThread(loading_context, worker_reporting_proxy));
haraken 2017/04/25 16:53:43 MakeUnique
nhiroki 2017/05/29 04:20:24 Let me keep this as is for now because (1) MakeUni
32 } 32 }
33 33
34 AudioWorkletThread::AudioWorkletThread( 34 AudioWorkletThread::AudioWorkletThread(
35 PassRefPtr<WorkerLoaderProxy> worker_loader_proxy, 35 ThreadableLoadingContext* loading_context,
36 WorkerReportingProxy& worker_reporting_proxy) 36 WorkerReportingProxy& worker_reporting_proxy)
37 : WorkerThread(std::move(worker_loader_proxy), worker_reporting_proxy) {} 37 : WorkerThread(loading_context, worker_reporting_proxy) {}
38 38
39 AudioWorkletThread::~AudioWorkletThread() {} 39 AudioWorkletThread::~AudioWorkletThread() {}
40 40
41 WorkerBackingThread& AudioWorkletThread::GetWorkerBackingThread() { 41 WorkerBackingThread& AudioWorkletThread::GetWorkerBackingThread() {
42 return *WorkletThreadHolder<AudioWorkletThread>::GetInstance()->GetThread(); 42 return *WorkletThreadHolder<AudioWorkletThread>::GetInstance()->GetThread();
43 } 43 }
44 44
45 void CollectAllGarbageOnAudioWorkletThread(WaitableEvent* done_event) { 45 void CollectAllGarbageOnAudioWorkletThread(WaitableEvent* done_event) {
46 blink::ThreadState::Current()->CollectAllGarbage(); 46 blink::ThreadState::Current()->CollectAllGarbage();
47 done_event->Signal(); 47 done_event->Signal();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 security_origin->TransferPrivilegesFrom( 85 security_origin->TransferPrivilegesFrom(
86 std::move(startup_data->starter_origin_privilege_data_)); 86 std::move(startup_data->starter_origin_privilege_data_));
87 } 87 }
88 88
89 return AudioWorkletGlobalScope::Create( 89 return AudioWorkletGlobalScope::Create(
90 startup_data->script_url_, startup_data->user_agent_, 90 startup_data->script_url_, startup_data->user_agent_,
91 security_origin.Release(), this->GetIsolate(), this); 91 security_origin.Release(), this->GetIsolate(), this);
92 } 92 }
93 93
94 } // namespace blink 94 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698