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 12 matching lines...) Expand all Loading... |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 * | 24 * |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 | 28 |
29 #include "core/workers/WorkerThread.h" | 29 #include "core/workers/WorkerThread.h" |
30 | 30 |
31 #include "bindings/v8/ScriptSourceCode.h" | 31 #include "bindings/v8/ScriptSourceCode.h" |
32 #include "core/inspector/InspectorInstrumentation.h" | 32 #include "core/inspector/InspectorInstrumentation.h" |
| 33 #include "core/inspector/WorkerInspectorController.h" |
33 #include "core/workers/DedicatedWorkerGlobalScope.h" | 34 #include "core/workers/DedicatedWorkerGlobalScope.h" |
34 #include "core/workers/WorkerClients.h" | 35 #include "core/workers/WorkerClients.h" |
35 #include "core/workers/WorkerReportingProxy.h" | 36 #include "core/workers/WorkerReportingProxy.h" |
36 #include "core/workers/WorkerThreadStartupData.h" | 37 #include "core/workers/WorkerThreadStartupData.h" |
37 #include "platform/PlatformThreadData.h" | 38 #include "platform/PlatformThreadData.h" |
38 #include "platform/heap/ThreadState.h" | 39 #include "platform/heap/ThreadState.h" |
39 #include "platform/weborigin/KURL.h" | 40 #include "platform/weborigin/KURL.h" |
40 #include "public/platform/Platform.h" | 41 #include "public/platform/Platform.h" |
41 #include "public/platform/WebWaitableEvent.h" | 42 #include "public/platform/WebWaitableEvent.h" |
42 #include "public/platform/WebWorkerRunLoop.h" | 43 #include "public/platform/WebWorkerRunLoop.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 m_threadID = createThread(WorkerThread::workerThreadStart, this, "WebCore: W
orker"); | 96 m_threadID = createThread(WorkerThread::workerThreadStart, this, "WebCore: W
orker"); |
96 | 97 |
97 return m_threadID; | 98 return m_threadID; |
98 } | 99 } |
99 | 100 |
100 void WorkerThread::workerThreadStart(void* thread) | 101 void WorkerThread::workerThreadStart(void* thread) |
101 { | 102 { |
102 static_cast<WorkerThread*>(thread)->workerThread(); | 103 static_cast<WorkerThread*>(thread)->workerThread(); |
103 } | 104 } |
104 | 105 |
| 106 void WorkerThread::interruptAndDispatchInspectorCommands() |
| 107 { |
| 108 MutexLocker locker(m_workerInspectorControllerMutex); |
| 109 if (m_workerInspectorController) |
| 110 m_workerInspectorController->interruptAndDispatchInspectorCommands(); |
| 111 } |
| 112 |
105 void WorkerThread::workerThread() | 113 void WorkerThread::workerThread() |
106 { | 114 { |
107 KURL scriptURL = m_startupData->m_scriptURL; | 115 KURL scriptURL = m_startupData->m_scriptURL; |
108 String sourceCode = m_startupData->m_sourceCode; | 116 String sourceCode = m_startupData->m_sourceCode; |
109 WorkerThreadStartMode startMode = m_startupData->m_startMode; | 117 WorkerThreadStartMode startMode = m_startupData->m_startMode; |
110 | 118 |
111 { | 119 { |
112 MutexLocker lock(m_threadCreationMutex); | 120 MutexLocker lock(m_threadCreationMutex); |
113 ThreadState::attach(); | 121 ThreadState::attach(); |
114 m_workerGlobalScope = createWorkerGlobalScope(m_startupData.release()); | 122 m_workerGlobalScope = createWorkerGlobalScope(m_startupData.release()); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 return; | 247 return; |
240 } | 248 } |
241 m_runLoop.terminate(); | 249 m_runLoop.terminate(); |
242 } | 250 } |
243 | 251 |
244 bool WorkerThread::isCurrentThread() const | 252 bool WorkerThread::isCurrentThread() const |
245 { | 253 { |
246 return m_threadID == currentThread(); | 254 return m_threadID == currentThread(); |
247 } | 255 } |
248 | 256 |
| 257 void WorkerThread::setWorkerInspectorController(PassRefPtrWillBeRawPtr<WorkerIns
pectorController> workerInspectorController) |
| 258 { |
| 259 MutexLocker locker(m_workerInspectorControllerMutex); |
| 260 m_workerInspectorController = workerInspectorController; |
| 261 } |
| 262 |
249 } // namespace WebCore | 263 } // namespace WebCore |
OLD | NEW |