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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 103 |
104 // Number of active worker threads. | 104 // Number of active worker threads. |
105 static unsigned workerThreadCount(); | 105 static unsigned workerThreadCount(); |
106 | 106 |
107 PlatformThreadId platformThreadId() const; | 107 PlatformThreadId platformThreadId() const; |
108 | 108 |
109 void interruptAndDispatchInspectorCommands(); | 109 void interruptAndDispatchInspectorCommands(); |
110 void setWorkerInspectorController(WorkerInspectorController*); | 110 void setWorkerInspectorController(WorkerInspectorController*); |
111 | 111 |
112 protected: | 112 protected: |
113 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPt
rWillBeRawPtr<WorkerThreadStartupData>); | 113 WorkerThread(PassRefPtr<WorkerLoaderProxy>, WorkerReportingProxy&, PassOwnPt
r<WorkerThreadStartupData>); |
114 | 114 |
115 // Factory method for creating a new worker context for the thread. | 115 // Factory method for creating a new worker context for the thread. |
116 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa
ssOwnPtrWillBeRawPtr<WorkerThreadStartupData>) = 0; | 116 virtual PassRefPtrWillBeRawPtr<WorkerGlobalScope> createWorkerGlobalScope(Pa
ssOwnPtr<WorkerThreadStartupData>) = 0; |
117 | 117 |
118 virtual void postInitialize() { } | 118 virtual void postInitialize() { } |
119 | 119 |
120 virtual v8::Isolate* initializeIsolate(); | 120 virtual v8::Isolate* initializeIsolate(); |
121 virtual void willDestroyIsolate(); | 121 virtual void willDestroyIsolate(); |
122 virtual void destroyIsolate(); | 122 virtual void destroyIsolate(); |
123 virtual void terminateV8Execution(); | 123 virtual void terminateV8Execution(); |
124 | 124 |
125 private: | 125 private: |
126 friend class WorkerSharedTimer; | 126 friend class WorkerSharedTimer; |
(...skipping 13 matching lines...) Expand all Loading... |
140 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; | 140 OwnPtr<WebThread::TaskObserver> m_microtaskRunner; |
141 | 141 |
142 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; | 142 RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
143 WorkerReportingProxy& m_workerReportingProxy; | 143 WorkerReportingProxy& m_workerReportingProxy; |
144 | 144 |
145 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; | 145 RefPtrWillBePersistent<WorkerInspectorController> m_workerInspectorControlle
r; |
146 Mutex m_workerInspectorControllerMutex; | 146 Mutex m_workerInspectorControllerMutex; |
147 | 147 |
148 Mutex m_threadCreationMutex; | 148 Mutex m_threadCreationMutex; |
149 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; | 149 RefPtrWillBePersistent<WorkerGlobalScope> m_workerGlobalScope; |
150 OwnPtrWillBePersistent<WorkerThreadStartupData> m_startupData; | 150 OwnPtr<WorkerThreadStartupData> m_startupData; |
151 | 151 |
152 v8::Isolate* m_isolate; | 152 v8::Isolate* m_isolate; |
153 OwnPtr<V8IsolateInterruptor> m_interruptor; | 153 OwnPtr<V8IsolateInterruptor> m_interruptor; |
154 | 154 |
155 // Used to signal thread shutdown. | 155 // Used to signal thread shutdown. |
156 OwnPtr<WebWaitableEvent> m_shutdownEvent; | 156 OwnPtr<WebWaitableEvent> m_shutdownEvent; |
157 | 157 |
158 // Used to signal thread termination. | 158 // Used to signal thread termination. |
159 OwnPtr<WebWaitableEvent> m_terminationEvent; | 159 OwnPtr<WebWaitableEvent> m_terminationEvent; |
160 | 160 |
161 // FIXME: This has to be last because of crbug.com/401397 - the | 161 // FIXME: This has to be last because of crbug.com/401397 - the |
162 // WorkerThread might get deleted before it had a chance to properly | 162 // WorkerThread might get deleted before it had a chance to properly |
163 // shut down. By deleting the WebThread first, we can guarantee that | 163 // shut down. By deleting the WebThread first, we can guarantee that |
164 // no pending tasks on the thread might want to access any of the other | 164 // no pending tasks on the thread might want to access any of the other |
165 // members during the WorkerThread's destruction. | 165 // members during the WorkerThread's destruction. |
166 OwnPtr<WebThreadSupportingGC> m_thread; | 166 OwnPtr<WebThreadSupportingGC> m_thread; |
167 }; | 167 }; |
168 | 168 |
169 } // namespace blink | 169 } // namespace blink |
170 | 170 |
171 #endif // WorkerThread_h | 171 #endif // WorkerThread_h |
OLD | NEW |