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

Unified Diff: third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h

Issue 2372303002: [worklets] Add AudioWorkletGlobalScope and AudioWorkletThread (Closed)
Patch Set: Fixing nits after l-g-t-m Created 4 years, 2 months 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 side-by-side diff with in-line comments
Download patch
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..df7683c46d04aee5d3cbd4949197d8a2943d2845
--- /dev/null
+++ b/third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h
@@ -0,0 +1,56 @@
+// 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(
+ std::unique_ptr<WorkerThreadStartupData>) final;
+
+ bool isOwningBackingThread() const override { return false; }
+
+ private:
+ explicit AudioWorkletThread(PassRefPtr<WorkerLoaderProxy>,
+ WorkerReportingProxy&);
+};
+
+} // namespace blink
+
+#endif // AudioWorkletThread_h

Powered by Google App Engine
This is Rietveld 408576698