Chromium Code Reviews| Index: third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h |
| diff --git a/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..527f9344722313b137741a15f4a325b4d438f6b9 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h |
| @@ -0,0 +1,55 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef AudioWorkletThread_h |
| +#define AudioWorkletThread_h |
| + |
| +#include "core/workers/WorkerLoaderProxy.h" |
| +#include "core/workers/WorkerThread.h" |
| +#include "modules/ModulesExport.h" |
| +#include <memory> |
| + |
| +namespace blink { |
| + |
| +class WorkerReportingProxy; |
| + |
| +// AudioWorkletThread is a per-frame singleton object that represents the |
| +// backing thread for the processing of AudioWorkletNode/AudioWorkletProcessor. |
| +// It is supposed to run an instance of V8 isolate. |
| + |
| +class MODULES_EXPORT AudioWorkletThread final : public WorkerThread { |
| + public: |
| + static std::unique_ptr<AudioWorkletThread> create( |
| + PassRefPtr<WorkerLoaderProxy>, |
| + WorkerReportingProxy&); |
| + ~AudioWorkletThread() override; |
| + |
| + WorkerBackingThread& workerBackingThread() override; |
| + |
| + // The backing thread is cleared by clearSharedBackingThread(). |
| + void clearWorkerBackingThread() override {} |
| + |
| + bool shouldAttachThreadDebugger() const override { return false; } |
| + |
| + // This may block the main thread. |
| + static void collectAllGarbage(); |
| + |
| + static void ensureSharedBackingThread(); |
| + static void createSharedBackingThreadForTest(); |
| + |
| + static void clearSharedBackingThread(); |
| + |
| + protected: |
| + WorkerOrWorkletGlobalScope* createWorkerGlobalScope( |
|
nhiroki
2016/10/12 02:27:44
explicit
hongchan
2016/10/12 17:24:05
This is not a constructor. I can add explicit to t
|
| + std::unique_ptr<WorkerThreadStartupData>) final; |
| + |
| + bool isOwningBackingThread() const override { return false; } |
| + |
| + private: |
| + AudioWorkletThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // AudioWorkletThread_h |