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 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 WorkerThread::WorkerThread(const char* threadName, PassRefPtr<WorkerLoaderProxy>
workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, PassOwnPtr<Worke
rThreadStartupData> startupData) | 259 WorkerThread::WorkerThread(const char* threadName, PassRefPtr<WorkerLoaderProxy>
workerLoaderProxy, WorkerReportingProxy& workerReportingProxy, PassOwnPtr<Worke
rThreadStartupData> startupData) |
260 : m_threadName(threadName) | 260 : m_threadName(threadName) |
261 , m_terminated(false) | 261 , m_terminated(false) |
262 , m_workerLoaderProxy(workerLoaderProxy) | 262 , m_workerLoaderProxy(workerLoaderProxy) |
263 , m_workerReportingProxy(workerReportingProxy) | 263 , m_workerReportingProxy(workerReportingProxy) |
264 , m_startupData(startupData) | 264 , m_startupData(startupData) |
265 , m_isolate(nullptr) | 265 , m_isolate(nullptr) |
266 , m_shutdownEvent(adoptPtr(blink::Platform::current()->createWaitableEvent()
)) | 266 , m_shutdownEvent(adoptPtr(blink::Platform::current()->createWaitableEvent()
)) |
267 , m_terminationEvent(adoptPtr(blink::Platform::current()->createWaitableEven
t())) | 267 , m_terminationEvent(adoptPtr(blink::Platform::current()->createWaitableEven
t())) |
| 268 , m_thread(nullptr) |
268 { | 269 { |
269 MutexLocker lock(threadSetMutex()); | 270 MutexLocker lock(threadSetMutex()); |
270 workerThreads().add(this); | 271 workerThreads().add(this); |
271 } | 272 } |
272 | 273 |
273 WorkerThread::~WorkerThread() | 274 WorkerThread::~WorkerThread() |
274 { | 275 { |
275 MutexLocker lock(threadSetMutex()); | 276 MutexLocker lock(threadSetMutex()); |
276 ASSERT(workerThreads().contains(this)); | 277 ASSERT(workerThreads().contains(this)); |
277 workerThreads().remove(this); | 278 workerThreads().remove(this); |
278 } | 279 } |
279 | 280 |
280 void WorkerThread::start() | 281 void WorkerThread::start() |
281 { | 282 { |
282 if (m_thread) | 283 if (m_thread) |
283 return; | 284 return; |
284 | 285 m_thread = m_startupData->m_thread; |
285 m_thread = createWebThreadSupportingGC(); | 286 if (!m_thread) { |
| 287 m_ownThread = createWebThreadSupportingGC(); |
| 288 m_thread = m_ownThread.get(); |
| 289 } |
286 m_thread->postTask(FROM_HERE, new Task(threadSafeBind(&WorkerThread::initial
ize, AllowCrossThreadAccess(this)))); | 290 m_thread->postTask(FROM_HERE, new Task(threadSafeBind(&WorkerThread::initial
ize, AllowCrossThreadAccess(this)))); |
287 } | 291 } |
288 | 292 |
289 void WorkerThread::interruptAndDispatchInspectorCommands() | 293 void WorkerThread::interruptAndDispatchInspectorCommands() |
290 { | 294 { |
291 MutexLocker locker(m_workerInspectorControllerMutex); | 295 MutexLocker locker(m_workerInspectorControllerMutex); |
292 if (m_workerInspectorController) | 296 if (m_workerInspectorController) |
293 m_workerInspectorController->interruptAndDispatchInspectorCommands(); | 297 m_workerInspectorController->interruptAndDispatchInspectorCommands(); |
294 } | 298 } |
295 | 299 |
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 615 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
612 } | 616 } |
613 | 617 |
614 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 618 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
615 { | 619 { |
616 MutexLocker locker(m_workerInspectorControllerMutex); | 620 MutexLocker locker(m_workerInspectorControllerMutex); |
617 m_workerInspectorController = workerInspectorController; | 621 m_workerInspectorController = workerInspectorController; |
618 } | 622 } |
619 | 623 |
620 } // namespace blink | 624 } // namespace blink |
OLD | NEW |