OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CompositorWorkerThread_h | 5 #ifndef CompositorWorkerThread_h |
6 #define CompositorWorkerThread_h | 6 #define CompositorWorkerThread_h |
7 | 7 |
8 #include "core/workers/WorkerThread.h" | 8 #include "core/workers/WorkerThread.h" |
9 #include "modules/ModulesExport.h" | 9 #include "modules/ModulesExport.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class InProcessWorkerObjectProxy; | 13 class InProcessWorkerObjectProxy; |
14 | 14 |
15 // This class is overridden in unit-tests. | |
16 class MODULES_EXPORT CompositorWorkerThread final : public WorkerThread { | 15 class MODULES_EXPORT CompositorWorkerThread final : public WorkerThread { |
17 public: | 16 public: |
18 static PassOwnPtr<CompositorWorkerThread> create(PassRefPtr<WorkerLoaderProx
y>, InProcessWorkerObjectProxy&, double timeOrigin); | 17 static PassOwnPtr<CompositorWorkerThread> create(PassRefPtr<WorkerLoaderProx
y>, InProcessWorkerObjectProxy&, double timeOrigin); |
19 ~CompositorWorkerThread() override; | 18 ~CompositorWorkerThread() override; |
20 | 19 |
21 InProcessWorkerObjectProxy& workerObjectProxy() const { return m_workerObjec
tProxy; } | 20 InProcessWorkerObjectProxy& workerObjectProxy() const { return m_workerObjec
tProxy; } |
22 WorkerBackingThread& workerBackingThread() override; | 21 WorkerBackingThread& workerBackingThread() override; |
23 bool shouldAttachThreadDebugger() const override { return false; } | 22 bool shouldAttachThreadDebugger() const override { return false; } |
24 | 23 |
25 static void ensureSharedBackingThread(); | 24 static void ensureSharedBackingThread(); |
26 static void createSharedBackingThreadForTest(); | 25 static void createSharedBackingThreadForTest(); |
27 | 26 |
28 // This is called before CoreInitializer::shutdown as shutdown waits for | |
29 // worker threads that can be blocked by scripts. | |
30 static void terminateExecution(); | |
31 static void clearSharedBackingThread(); | 27 static void clearSharedBackingThread(); |
32 | 28 |
33 protected: | 29 protected: |
34 CompositorWorkerThread(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectP
roxy&, double timeOrigin); | 30 CompositorWorkerThread(PassRefPtr<WorkerLoaderProxy>, InProcessWorkerObjectP
roxy&, double timeOrigin); |
35 | 31 |
36 WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupDat
a>) override; | 32 WorkerGlobalScope* createWorkerGlobalScope(PassOwnPtr<WorkerThreadStartupDat
a>) override; |
| 33 bool isOwningBackingThread() const override { return false; } |
37 | 34 |
38 private: | 35 private: |
39 InProcessWorkerObjectProxy& m_workerObjectProxy; | 36 InProcessWorkerObjectProxy& m_workerObjectProxy; |
40 double m_timeOrigin; | 37 double m_timeOrigin; |
41 }; | 38 }; |
42 | 39 |
43 } // namespace blink | 40 } // namespace blink |
44 | 41 |
45 #endif // CompositorWorkerThread_h | 42 #endif // CompositorWorkerThread_h |
OLD | NEW |