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

Side by Side Diff: third_party/WebKit/Source/modules/webaudio/AudioWorkletThread.h

Issue 2432543002: Refactoring WorkletThreadBackingHolder with template pattern (Closed)
Patch Set: Clean up and rename template class file Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef AudioWorkletThread_h 5 #ifndef AudioWorkletThread_h
6 #define AudioWorkletThread_h 6 #define AudioWorkletThread_h
7 7
8 #include "core/workers/WorkerLoaderProxy.h" 8 #include "core/workers/WorkerLoaderProxy.h"
9 #include "core/workers/WorkerThread.h" 9 #include "core/workers/WorkerThread.h"
10 #include "core/workers/WorkletThreadHolder.h"
10 #include "modules/ModulesExport.h" 11 #include "modules/ModulesExport.h"
11 #include <memory> 12 #include <memory>
12 13
13 namespace blink { 14 namespace blink {
14 15
15 class WorkerReportingProxy; 16 class WorkerReportingProxy;
16 17
17 // AudioWorkletThread is a per-frame singleton object that represents the 18 // AudioWorkletThread is a per-frame singleton object that represents the
18 // backing thread for the processing of AudioWorkletNode/AudioWorkletProcessor. 19 // backing thread for the processing of AudioWorkletNode/AudioWorkletProcessor.
19 // It is supposed to run an instance of V8 isolate. 20 // It is supposed to run an instance of V8 isolate.
20 21
21 class MODULES_EXPORT AudioWorkletThread final : public WorkerThread { 22 class MODULES_EXPORT AudioWorkletThread final : public WorkerThread {
22 public: 23 public:
23 static std::unique_ptr<AudioWorkletThread> create( 24 static std::unique_ptr<AudioWorkletThread> create(
24 PassRefPtr<WorkerLoaderProxy>, 25 PassRefPtr<WorkerLoaderProxy>,
25 WorkerReportingProxy&); 26 WorkerReportingProxy&);
26 ~AudioWorkletThread() override; 27 ~AudioWorkletThread() override;
27 28
28 WorkerBackingThread& workerBackingThread() override; 29 WorkerBackingThread& workerBackingThread() override;
29 30
30 // The backing thread is cleared by clearSharedBackingThread(). 31 // The backing thread is cleared by clearSharedBackingThread().
31 void clearWorkerBackingThread() override {} 32 void clearWorkerBackingThread() override {}
32 33
33 bool shouldAttachThreadDebugger() const override { return false; } 34 bool shouldAttachThreadDebugger() const override { return false; }
34 35
35 // This may block the main thread. 36 // This may block the main thread.
36 static void collectAllGarbage(); 37 static void collectAllGarbage();
37 38
38 static void ensureSharedBackingThread(); 39 static void ensureSharedBackingThread();
40 static void clearSharedBackingThread();
41
39 static void createSharedBackingThreadForTest(); 42 static void createSharedBackingThreadForTest();
40 43
41 static void clearSharedBackingThread();
42
43 protected: 44 protected:
44 WorkerOrWorkletGlobalScope* createWorkerGlobalScope( 45 WorkerOrWorkletGlobalScope* createWorkerGlobalScope(
45 std::unique_ptr<WorkerThreadStartupData>) final; 46 std::unique_ptr<WorkerThreadStartupData>) final;
46 47
47 bool isOwningBackingThread() const override { return false; } 48 bool isOwningBackingThread() const override { return false; }
48 49
49 private: 50 private:
50 explicit AudioWorkletThread(PassRefPtr<WorkerLoaderProxy>, 51 explicit AudioWorkletThread(PassRefPtr<WorkerLoaderProxy>,
nhiroki 2016/10/27 00:03:35 Can you remove 'explicit'?
hongchan 2016/10/27 17:31:06 Done.
51 WorkerReportingProxy&); 52 WorkerReportingProxy&);
52 }; 53 };
53 54
54 } // namespace blink 55 } // namespace blink
55 56
56 #endif // AudioWorkletThread_h 57 #endif // AudioWorkletThread_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698