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

Unified Diff: Source/modules/compositorworker/CompositorWorkerManager.h

Issue 1158443008: compositor-worker: Share a thread and an isolate for compositor workers. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tot-merge Created 5 years, 6 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
« no previous file with comments | « Source/modules/InitModules.cpp ('k') | Source/modules/compositorworker/CompositorWorkerManager.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/compositorworker/CompositorWorkerManager.h
diff --git a/Source/modules/compositorworker/CompositorWorkerManager.h b/Source/modules/compositorworker/CompositorWorkerManager.h
new file mode 100644
index 0000000000000000000000000000000000000000..d7ffaa1aa008bf2a019b0230ed64bc64b3ba7496
--- /dev/null
+++ b/Source/modules/compositorworker/CompositorWorkerManager.h
@@ -0,0 +1,56 @@
+// Copyright 2015 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 CompositorWorkerManager_h
+#define CompositorWorkerManager_h
+
+#include "modules/ModulesExport.h"
+#include "wtf/OwnPtr.h"
+#include "wtf/PassOwnPtr.h"
+#include "wtf/ThreadingPrimitives.h"
+#include <v8.h>
+
+namespace blink {
+
+class V8IsolateInterruptor;
+class WebThreadSupportingGC;
+
+class MODULES_EXPORT CompositorWorkerManager final {
+public:
+ static void initialize();
+ static void shutdown();
+
+ static CompositorWorkerManager* instance();
+
+ // Returns the thread used for compositor workers. This creates a new thread if a
+ // thread doesn't already exist.
+ WebThreadSupportingGC& compositorWorkerThread();
+
+ // Attempts to initialize/shutdown a thread if necessary. Does nothing if the thread
+ // is already initialized, or if the thread has more than one active workers at the
+ // time of shutdown.
+ void initializeBackingThread();
+ void shutdownBackingThread();
+
+ v8::Isolate* initializeIsolate();
+ void willDestroyIsolate();
+ void destroyIsolate();
+ void terminateV8Execution();
+
+private:
+ friend class CompositorWorkerManagerTest;
+
+ CompositorWorkerManager();
+ ~CompositorWorkerManager();
+
+ Mutex m_mutex;
+ OwnPtr<WebThreadSupportingGC> m_thread;
+ int m_workerCount = 0;
+ v8::Isolate* m_isolate = nullptr;
+ OwnPtr<V8IsolateInterruptor> m_interruptor;
+};
+
+} // namespace blink
+
+#endif // CompositorWorkerManager_h
« no previous file with comments | « Source/modules/InitModules.cpp ('k') | Source/modules/compositorworker/CompositorWorkerManager.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698