Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef AudioWorkletThread_h | |
| 6 #define AudioWorkletThread_h | |
| 7 | |
| 8 #include "core/workers/WorkerLoaderProxy.h" | |
| 9 #include "core/workers/WorkerThread.h" | |
| 10 #include "modules/ModulesExport.h" | |
| 11 #include <memory> | |
| 12 | |
| 13 namespace blink { | |
| 14 | |
| 15 class WorkerReportingProxy; | |
| 16 | |
| 17 // AudioWorkletThread is a per-frame singleton object that represents the | |
| 18 // backing thread for the processing of AudioWorkletNode/AudioWorkletProcessor. | |
| 19 // It is supposed to run an instance of V8 isolate. | |
| 20 | |
| 21 class MODULES_EXPORT AudioWorkletThread final : public WorkerThread { | |
| 22 public: | |
| 23 static std::unique_ptr<AudioWorkletThread> create(PassRefPtr<WorkerLoaderPro xy>, WorkerReportingProxy&); | |
| 24 ~AudioWorkletThread() override; | |
| 25 | |
| 26 WorkerBackingThread& workerBackingThread() override; | |
| 27 void clearWorkerBackingThread() override | |
| 28 { | |
| 29 // Do nothing. | |
| 30 // The backing thread is cleared by clearSharedBackingThread(). | |
| 31 } | |
| 32 | |
| 33 bool shouldAttachThreadDebugger() const override { return false; } | |
| 34 | |
| 35 static void collectAllGarbage(); | |
|
nhiroki
2016/09/30 11:28:57
Can you add a comment that this may block the main
hongchan
2016/10/11 23:42:38
Done.
| |
| 36 | |
| 37 static void ensureSharedBackingThread(); | |
| 38 static void createSharedBackingThreadForTest(); | |
| 39 static void clearSharedBackingThread(); | |
| 40 | |
| 41 protected: | |
| 42 WorkerOrWorkletGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerTh readStartupData>) final; | |
| 43 | |
| 44 bool isOwningBackingThread() const override { return false; } | |
| 45 | |
| 46 private: | |
| 47 AudioWorkletThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); | |
| 48 }; | |
| 49 | |
| 50 } // namespace blink | |
| 51 | |
| 52 #endif // AudioWorkletThread_h | |
| OLD | NEW |