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

Side by Side Diff: Source/core/workers/WorkerThread.h

Issue 1018863002: compositor-worker: Introduce CompositorWorker. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: . Created 5 years, 9 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
« no previous file with comments | « Source/core/workers/WorkerMessagingProxy.cpp ('k') | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 PauseWorkerGlobalScopeOnStart 58 PauseWorkerGlobalScopeOnStart
59 }; 59 };
60 60
61 class CORE_EXPORT WorkerThread : public RefCounted<WorkerThread> { 61 class CORE_EXPORT WorkerThread : public RefCounted<WorkerThread> {
62 public: 62 public:
63 virtual ~WorkerThread(); 63 virtual ~WorkerThread();
64 64
65 virtual void start(); 65 virtual void start();
66 virtual void stop(); 66 virtual void stop();
67 67
68 void didStartRunLoop(); 68 virtual PassOwnPtr<WebThreadSupportingGC> createWebThreadSupportingGC();
69 void didStopRunLoop(); 69 virtual void didStartRunLoop();
70 virtual void didStopRunLoop();
70 71
71 v8::Isolate* isolate() const { return m_isolate; } 72 v8::Isolate* isolate() const { return m_isolate; }
72 73
73 // Can be used to wait for this worker thread to shut down. 74 // Can be used to wait for this worker thread to shut down.
74 // (This is signalled on the main thread, so it's assumed to be waited on th e worker context thread) 75 // (This is signalled on the main thread, so it's assumed to be waited on th e worker context thread)
75 WebWaitableEvent* shutdownEvent() { return m_shutdownEvent.get(); } 76 WebWaitableEvent* shutdownEvent() { return m_shutdownEvent.get(); }
76 77
77 WebWaitableEvent* terminationEvent() { return m_terminationEvent.get(); } 78 WebWaitableEvent* terminationEvent() { return m_terminationEvent.get(); }
78 void terminateAndWait(); 79 void terminateAndWait();
79 static void terminateAndWaitForAllWorkers(); 80 static void terminateAndWaitForAllWorkers();
(...skipping 30 matching lines...) Expand all
110 void setWorkerInspectorController(WorkerInspectorController*); 111 void setWorkerInspectorController(WorkerInspectorController*);
111 112
112 protected: 113 protected:
113 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPt rWillBeRawPtr<WorkerThreadStartupData>); 114 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPt rWillBeRawPtr<WorkerThreadStartupData>);
114 115
115 // Factory method for creating a new worker context for the thread. 116 // Factory method for creating a new worker context for the thread.
116 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0; 117 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa ssOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0;
117 118
118 virtual void postInitialize() { } 119 virtual void postInitialize() { }
119 120
121 virtual v8::Isolate* initializeIsolate();
122 virtual void willDestroyIsolate();
123 virtual void destroyIsolate();
124 virtual void terminateV8Execution();
125
120 private: 126 private:
121 friend class WorkerSharedTimer; 127 friend class WorkerSharedTimer;
122 friend class WorkerThreadShutdownFinishTask; 128 friend class WorkerThreadShutdownFinishTask;
123 129
124 void stopInShutdownSequence(); 130 void stopInShutdownSequence();
125 void stopInternal(); 131 void stopInternal();
126 132
127 void initialize(); 133 void initialize();
128 void cleanup(); 134 void cleanup();
129 void idleHandler(); 135 void idleHandler();
130 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs); 136 void postDelayedTask(PassOwnPtr<ExecutionContextTask>, long long delayMs);
131 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas k>, long long delayMs); 137 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas k>, long long delayMs);
132 138
133 v8::Isolate* initializeIsolate();
134 void willDestroyIsolate();
135 void destroyIsolate();
136 void terminateV8Execution();
137
138 bool m_terminated; 139 bool m_terminated;
139 OwnPtr<WorkerSharedTimer> m_sharedTimer; 140 OwnPtr<WorkerSharedTimer> m_sharedTimer;
140 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue; 141 MessageQueue<WorkerThreadTask> m_debuggerMessageQueue;
141 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; 142 OwnPtr<WebThread::TaskObserver> m_microtaskRunner;
142 143
143 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; 144 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy;
144 WorkerReportingProxy& m_workerReportingProxy; 145 WorkerReportingProxy& m_workerReportingProxy;
145 146
146 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r; 147 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle r;
147 Mutex m_workerInspectorControllerMutex; 148 Mutex m_workerInspectorControllerMutex;
(...skipping 15 matching lines...) Expand all
163 // WorkerThread might get deleted before it had a chance to properly 164 // WorkerThread might get deleted before it had a chance to properly
164 // shut down. By deleting the WebThread first, we can guarantee that 165 // shut down. By deleting the WebThread first, we can guarantee that
165 // no pending tasks on the thread might want to access any of the other 166 // no pending tasks on the thread might want to access any of the other
166 // members during the WorkerThread's destruction. 167 // members during the WorkerThread's destruction.
167 OwnPtr<WebThreadSupportingGC> m_thread; 168 OwnPtr<WebThreadSupportingGC> m_thread;
168 }; 169 };
169 170
170 } // namespace blink 171 } // namespace blink
171 172
172 #endif // WorkerThread_h 173 #endif // WorkerThread_h
OLDNEW
« no previous file with comments | « Source/core/workers/WorkerMessagingProxy.cpp ('k') | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698