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 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
409 // Prevent the deadlock between GC and an attempt to stop a thread. | 409 // Prevent the deadlock between GC and an attempt to stop a thread. |
410 ThreadState::SafePointScope safePointScope(ThreadState::HeapPointersOnStack)
; | 410 ThreadState::SafePointScope safePointScope(ThreadState::HeapPointersOnStack)
; |
411 stopInternal(); | 411 stopInternal(); |
412 } | 412 } |
413 | 413 |
414 void WorkerThread::stopInShutdownSequence() | 414 void WorkerThread::stopInShutdownSequence() |
415 { | 415 { |
416 stopInternal(); | 416 stopInternal(); |
417 } | 417 } |
418 | 418 |
| 419 void WorkerThread::terminateAndWait() |
| 420 { |
| 421 stop(); |
| 422 m_terminationEvent->wait(); |
| 423 } |
| 424 |
419 bool WorkerThread::terminated() | 425 bool WorkerThread::terminated() |
420 { | 426 { |
421 MutexLocker lock(m_threadCreationMutex); | 427 MutexLocker lock(m_threadCreationMutex); |
422 return m_terminated; | 428 return m_terminated; |
423 } | 429 } |
424 | 430 |
425 void WorkerThread::stopInternal() | 431 void WorkerThread::stopInternal() |
426 { | 432 { |
427 // Protect against this method and initialize() racing each other. | 433 // Protect against this method and initialize() racing each other. |
428 MutexLocker lock(m_threadCreationMutex); | 434 MutexLocker lock(m_threadCreationMutex); |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 533 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
528 } | 534 } |
529 | 535 |
530 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 536 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
531 { | 537 { |
532 MutexLocker locker(m_workerInspectorControllerMutex); | 538 MutexLocker locker(m_workerInspectorControllerMutex); |
533 m_workerInspectorController = workerInspectorController; | 539 m_workerInspectorController = workerInspectorController; |
534 } | 540 } |
535 | 541 |
536 } // namespace blink | 542 } // namespace blink |
OLD | NEW |