| 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( |
| 24 PassRefPtr<WorkerLoaderProxy>, |
| 25 WorkerReportingProxy&); |
| 26 ~AudioWorkletThread() override; |
| 27 |
| 28 WorkerBackingThread& workerBackingThread() override; |
| 29 |
| 30 // The backing thread is cleared by clearSharedBackingThread(). |
| 31 void clearWorkerBackingThread() override {} |
| 32 |
| 33 bool shouldAttachThreadDebugger() const override { return false; } |
| 34 |
| 35 // This may block the main thread. |
| 36 static void collectAllGarbage(); |
| 37 |
| 38 static void ensureSharedBackingThread(); |
| 39 static void createSharedBackingThreadForTest(); |
| 40 |
| 41 static void clearSharedBackingThread(); |
| 42 |
| 43 protected: |
| 44 WorkerOrWorkletGlobalScope* createWorkerGlobalScope( |
| 45 std::unique_ptr<WorkerThreadStartupData>) final; |
| 46 |
| 47 bool isOwningBackingThread() const override { return false; } |
| 48 |
| 49 private: |
| 50 explicit AudioWorkletThread(PassRefPtr<WorkerLoaderProxy>, |
| 51 WorkerReportingProxy&); |
| 52 }; |
| 53 |
| 54 } // namespace blink |
| 55 |
| 56 #endif // AudioWorkletThread_h |
| OLD | NEW |