| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CompositorWorkerManager_h | |
| 6 #define CompositorWorkerManager_h | |
| 7 | |
| 8 #include "modules/ModulesExport.h" | |
| 9 #include "wtf/OwnPtr.h" | |
| 10 #include "wtf/PassOwnPtr.h" | |
| 11 #include "wtf/ThreadingPrimitives.h" | |
| 12 #include <v8.h> | |
| 13 | |
| 14 namespace blink { | |
| 15 | |
| 16 class V8IsolateInterruptor; | |
| 17 class WebThread; | |
| 18 class WebThreadSupportingGC; | |
| 19 | |
| 20 class MODULES_EXPORT CompositorWorkerManager final { | |
| 21 USING_FAST_MALLOC(CompositorWorkerManager); | |
| 22 public: | |
| 23 static void initialize(); | |
| 24 static void shutdown(); | |
| 25 | |
| 26 static CompositorWorkerManager* instance(); | |
| 27 | |
| 28 // Returns the thread used for compositor workers. This creates a new thread
if a | |
| 29 // thread doesn't already exist. | |
| 30 WebThreadSupportingGC& compositorWorkerThread(); | |
| 31 | |
| 32 // Attempts to initialize/shutdown a thread if necessary. Does nothing if th
e thread | |
| 33 // is already initialized, or if the thread has more than one active workers
at the | |
| 34 // time of shutdown. | |
| 35 void initializeBackingThread(); | |
| 36 void shutdownBackingThread(); | |
| 37 | |
| 38 v8::Isolate* initializeIsolate(); | |
| 39 void willDestroyIsolate(); | |
| 40 void destroyIsolate(); | |
| 41 void terminateV8Execution(); | |
| 42 | |
| 43 private: | |
| 44 friend class CompositorWorkerManagerTest; | |
| 45 | |
| 46 CompositorWorkerManager(); | |
| 47 ~CompositorWorkerManager(); | |
| 48 | |
| 49 Mutex m_mutex; | |
| 50 OwnPtr<WebThreadSupportingGC> m_thread; | |
| 51 OwnPtr<WebThread> m_platformThread; | |
| 52 int m_workerCount = 0; | |
| 53 v8::Isolate* m_isolate = nullptr; | |
| 54 }; | |
| 55 | |
| 56 } // namespace blink | |
| 57 | |
| 58 #endif // CompositorWorkerManager_h | |
| OLD | NEW |