OLD | NEW |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 virtual ~WorkerThread(); | 61 virtual ~WorkerThread(); |
62 | 62 |
63 // Called on the main thread. | 63 // Called on the main thread. |
64 void start(PassOwnPtr<WorkerThreadStartupData>); | 64 void start(PassOwnPtr<WorkerThreadStartupData>); |
65 void terminate(); | 65 void terminate(); |
66 | 66 |
67 // Returns the thread this worker runs on. Some implementations can create | 67 // Returns the thread this worker runs on. Some implementations can create |
68 // a new thread on the first call (e.g. shared, dedicated workers), whereas | 68 // a new thread on the first call (e.g. shared, dedicated workers), whereas |
69 // some implementations can use an existing thread that is already being | 69 // some implementations can use an existing thread that is already being |
70 // used by other workers (e.g. compositor workers). | 70 // used by other workers (e.g. compositor workers). |
71 virtual WebThreadSupportingGC& backingThread() = 0; | 71 virtual WebThread& backingThread() = 0; |
72 | 72 |
73 virtual void didStartRunLoop(); | 73 virtual void didStartRunLoop(); |
74 virtual void didStopRunLoop(); | 74 virtual void didStopRunLoop(); |
75 | 75 |
76 v8::Isolate* isolate() const { return m_isolate; } | 76 v8::Isolate* isolate() const { return m_isolate; } |
77 | 77 |
78 // Can be used to wait for this worker thread to shut down. | 78 // Can be used to wait for this worker thread to shut down. |
79 // (This is signaled on the main thread, so it's assumed to be waited on | 79 // (This is signaled on the main thread, so it's assumed to be waited on |
80 // the worker context thread) | 80 // the worker context thread) |
81 WebWaitableEvent* shutdownEvent() { return m_shutdownEvent.get(); } | 81 WebWaitableEvent* shutdownEvent() { return m_shutdownEvent.get(); } |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 friend class WorkerMicrotaskRunner; | 143 friend class WorkerMicrotaskRunner; |
144 | 144 |
145 // Called on the main thread. | 145 // Called on the main thread. |
146 void terminateInternal(); | 146 void terminateInternal(); |
147 | 147 |
148 // Called on the worker thread. | 148 // Called on the worker thread. |
149 void initialize(PassOwnPtr<WorkerThreadStartupData>); | 149 void initialize(PassOwnPtr<WorkerThreadStartupData>); |
150 void shutdown(); | 150 void shutdown(); |
151 void performShutdownTask(); | 151 void performShutdownTask(); |
152 void performIdleWork(double deadlineSeconds); | 152 void performIdleWork(double deadlineSeconds); |
153 void postDelayedTask(const WebTraceLocation&, PassOwnPtr<ExecutionContextTas
k>, long long delayMs); | |
154 | 153 |
155 bool m_started; | 154 bool m_started; |
156 bool m_terminated; | 155 bool m_terminated; |
157 bool m_shutdown; | 156 bool m_shutdown; |
158 MessageQueue<WebThread::Task> m_debuggerMessageQueue; | 157 MessageQueue<WebThread::Task> m_debuggerMessageQueue; |
159 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; | 158 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; |
160 | 159 |
161 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; | 160 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
162 WorkerReportingProxy& m_workerReportingProxy; | 161 WorkerReportingProxy& m_workerReportingProxy; |
163 RawPtr<WebScheduler> m_webScheduler; // Not owned. | 162 RawPtr<WebScheduler> m_webScheduler; // Not owned. |
164 | 163 |
165 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; | 164 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; |
166 Mutex m_workerInspectorControllerMutex; | 165 Mutex m_workerInspectorControllerMutex; |
167 | 166 |
168 // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_isolate| and
|m_microtaskRunner|. | 167 // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_isolate| and
|m_microtaskRunner|. |
169 Mutex m_threadStateMutex; | 168 Mutex m_threadStateMutex; |
170 | 169 |
171 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; | 170 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
172 | 171 |
| 172 OwnPtr<GCSupportForWebThread> m_gcSupport; |
173 v8::Isolate* m_isolate; | 173 v8::Isolate* m_isolate; |
174 | 174 |
175 // Used to signal thread shutdown. | 175 // Used to signal thread shutdown. |
176 OwnPtr<WebWaitableEvent> m_shutdownEvent; | 176 OwnPtr<WebWaitableEvent> m_shutdownEvent; |
177 | 177 |
178 // Used to signal thread termination. | 178 // Used to signal thread termination. |
179 OwnPtr<WebWaitableEvent> m_terminationEvent; | 179 OwnPtr<WebWaitableEvent> m_terminationEvent; |
180 }; | 180 }; |
181 | 181 |
182 } // namespace blink | 182 } // namespace blink |
183 | 183 |
184 #endif // WorkerThread_h | 184 #endif // WorkerThread_h |
OLD | NEW |