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

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, 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 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 "modules/ModulesExport.h"
10 #include "wtf/OwnPtr.h"
11 #include "wtf/PassOwnPtr.h"
12 #include "wtf/ThreadingPrimitives.h"
13 #include <v8.h>
14
15 namespace blink {
16
17 class WebThreadSupportingGC;
18
19 class MODULES_EXPORT CompositorWorkerManager final {
20 public:
21 static void initialize();
22 static void shutdown();
23
24 static CompositorWorkerManager* instance();
25
26 // Returns the thread used for compositor workers. This creates a new thread if a
27 // thread doesn't already exist.
28 WebThreadSupportingGC& compositorWorkerThread();
29
30 // Attempts to initialize/shutdown a thread if necessary. Does nothing if th e thread
31 // is already initialized, or if the thread has more than one active workers at the
32 // time of shutdown.
33 void initializeBackingThread();
34 void shutdownBackingThread();
35
36 PassOwnPtr<WorkerV8Isolate> createIsolate();
37 void willDestroyIsolate();
38 void destroyIsolate();
39 void terminateIsolate();
40
41 private:
42 CompositorWorkerManager();
43 ~CompositorWorkerManager();
44
45 Mutex m_mutex;
46 OwnPtr<WebThreadSupportingGC> m_thread;
47 int m_workerCount = 0;
48 OwnPtr<WorkerV8Isolate> m_isolate;
49 int m_isolateCount = 0;
kinuko 2015/05/31 15:18:24 Using manual counters is not great especially if w
sadrul 2015/06/01 05:24:11 Done.
50 };
51
52 } // namespace blink
53
54 #endif // CompositorWorkerManager_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698