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

Side by Side 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: . Created 5 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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 "core/workers/WorkerV8Isolate.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 WebThreadSupportingGC;
17
18 class CompositorWorkerManager final {
19 public:
20 static void initialize();
21 static void shutdown();
22
23 static CompositorWorkerManager* instance();
24
25 // Returns the thread used for compositor workers. This creates a new thread if a
26 // thread doesn't already exist.
27 WebThreadSupportingGC& compositorWorkerThread();
28
29 // Attempts to initialize/shutdown a thread if necessary. Does nothing if th e thread
30 // is already initialized, or if the thread has more than one active workers at the
31 // time of shutdown.
32 void initializeBackingThread();
33 void shutdownBackingThread();
34
35 PassOwnPtr<WorkerV8Isolate> createIsolate();
36 void willDestroyIsolate();
37 void destroyIsolate();
38 void terminateIsolate();
39
40 private:
41 CompositorWorkerManager();
42 ~CompositorWorkerManager();
43
44 Mutex m_mutex;
45 OwnPtr<WebThreadSupportingGC> m_thread;
46 int m_workerCount = 0;
47 OwnPtr<WorkerV8Isolate> m_isolate;
48 int m_isolateCount = 0;
49 };
50
51 } // namespace blink
52
53 #endif // CompositorWorkerManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698