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

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

Issue 2579823002: Worker: Rename WorkletThreadHolder::threadHolderInstance() to getInstance() (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « third_party/WebKit/Source/modules/compositorworker/AbstractAnimationWorkletThread.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/workers/WorkerBackingThread.h" 7 #include "core/workers/WorkerBackingThread.h"
8 #include "core/workers/WorkerThreadStartupData.h" 8 #include "core/workers/WorkerThreadStartupData.h"
9 #include "modules/webaudio/AudioWorkletGlobalScope.h" 9 #include "modules/webaudio/AudioWorkletGlobalScope.h"
10 #include "platform/CrossThreadFunctional.h" 10 #include "platform/CrossThreadFunctional.h"
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 AudioWorkletThread::AudioWorkletThread( 34 AudioWorkletThread::AudioWorkletThread(
35 PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, 35 PassRefPtr<WorkerLoaderProxy> workerLoaderProxy,
36 WorkerReportingProxy& workerReportingProxy) 36 WorkerReportingProxy& workerReportingProxy)
37 : WorkerThread(std::move(workerLoaderProxy), workerReportingProxy) {} 37 : WorkerThread(std::move(workerLoaderProxy), workerReportingProxy) {}
38 38
39 AudioWorkletThread::~AudioWorkletThread() {} 39 AudioWorkletThread::~AudioWorkletThread() {}
40 40
41 WorkerBackingThread& AudioWorkletThread::workerBackingThread() { 41 WorkerBackingThread& AudioWorkletThread::workerBackingThread() {
42 return *WorkletThreadHolder<AudioWorkletThread>::threadHolderInstance() 42 return *WorkletThreadHolder<AudioWorkletThread>::getInstance()->thread();
43 ->thread();
44 } 43 }
45 44
46 void collectAllGarbageOnAudioWorkletThread(WaitableEvent* doneEvent) { 45 void collectAllGarbageOnAudioWorkletThread(WaitableEvent* doneEvent) {
47 blink::ThreadState::current()->collectAllGarbage(); 46 blink::ThreadState::current()->collectAllGarbage();
48 doneEvent->signal(); 47 doneEvent->signal();
49 } 48 }
50 49
51 void AudioWorkletThread::collectAllGarbage() { 50 void AudioWorkletThread::collectAllGarbage() {
52 DCHECK(isMainThread()); 51 DCHECK(isMainThread());
53 WaitableEvent doneEvent; 52 WaitableEvent doneEvent;
54 WorkletThreadHolder<AudioWorkletThread>* threadHolderInstance = 53 WorkletThreadHolder<AudioWorkletThread>* workletThreadHolder =
55 WorkletThreadHolder<AudioWorkletThread>::threadHolderInstance(); 54 WorkletThreadHolder<AudioWorkletThread>::getInstance();
56 if (!threadHolderInstance) 55 if (!workletThreadHolder)
57 return; 56 return;
58 threadHolderInstance->thread()->backingThread().postTask( 57 workletThreadHolder->thread()->backingThread().postTask(
59 BLINK_FROM_HERE, crossThreadBind(&collectAllGarbageOnAudioWorkletThread, 58 BLINK_FROM_HERE, crossThreadBind(&collectAllGarbageOnAudioWorkletThread,
60 crossThreadUnretained(&doneEvent))); 59 crossThreadUnretained(&doneEvent)));
61 doneEvent.wait(); 60 doneEvent.wait();
62 } 61 }
63 62
64 void AudioWorkletThread::ensureSharedBackingThread() { 63 void AudioWorkletThread::ensureSharedBackingThread() {
65 DCHECK(isMainThread()); 64 DCHECK(isMainThread());
66 WorkletThreadHolder<AudioWorkletThread>::ensureInstance("AudioWorkletThread"); 65 WorkletThreadHolder<AudioWorkletThread>::ensureInstance("AudioWorkletThread");
67 } 66 }
68 67
(...skipping 17 matching lines...) Expand all
86 securityOrigin->transferPrivilegesFrom( 85 securityOrigin->transferPrivilegesFrom(
87 std::move(startupData->m_starterOriginPrivilegeData)); 86 std::move(startupData->m_starterOriginPrivilegeData));
88 } 87 }
89 88
90 return AudioWorkletGlobalScope::create( 89 return AudioWorkletGlobalScope::create(
91 startupData->m_scriptURL, startupData->m_userAgent, 90 startupData->m_scriptURL, startupData->m_userAgent,
92 securityOrigin.release(), this->isolate(), this); 91 securityOrigin.release(), this->isolate(), this);
93 } 92 }
94 93
95 } // namespace blink 94 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/compositorworker/AbstractAnimationWorkletThread.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698