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..ea9227bbd3b1131c44e79d607b459fa14c0f2d97 |
| --- /dev/null |
| +++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h |
| @@ -0,0 +1,52 @@ |
| +// 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; |
| + void clearWorkerBackingThread() override |
| + { |
| + // Do nothing. |
| + // The backing thread is cleared by clearSharedBackingThread(). |
| + } |
| + |
| + bool shouldAttachThreadDebugger() const override { return false; } |
| + |
| + 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.
|
| + |
| + static void ensureSharedBackingThread(); |
| + static void createSharedBackingThreadForTest(); |
| + static void clearSharedBackingThread(); |
| + |
| +protected: |
| + WorkerOrWorkletGlobalScope* createWorkerGlobalScope(std::unique_ptr<WorkerThreadStartupData>) final; |
| + |
| + bool isOwningBackingThread() const override { return false; } |
| + |
| +private: |
| + AudioWorkletThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&); |
| +}; |
| + |
| +} // namespace blink |
| + |
| +#endif // AudioWorkletThread_h |