Chromium Code Reviews| 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 170 | 170 |
| 171 WorkerThread::~WorkerThread() | 171 WorkerThread::~WorkerThread() |
| 172 { | 172 { |
| 173 MutexLocker lock(threadSetMutex()); | 173 MutexLocker lock(threadSetMutex()); |
| 174 ASSERT(workerThreads().contains(this)); | 174 ASSERT(workerThreads().contains(this)); |
| 175 workerThreads().remove(this); | 175 workerThreads().remove(this); |
| 176 } | 176 } |
| 177 | 177 |
| 178 void WorkerThread::start(PassOwnPtr<WorkerThreadStartupData> startupData) | 178 void WorkerThread::start(PassOwnPtr<WorkerThreadStartupData> startupData) |
| 179 { | 179 { |
| 180 ASSERT(isMainThread()); | |
| 180 if (m_started) | 181 if (m_started) |
| 181 return; | 182 return; |
| 182 | 183 |
| 183 m_started = true; | 184 m_started = true; |
| 184 backingThread().postTask(FROM_HERE, new Task(threadSafeBind(&WorkerThread::i nitialize, AllowCrossThreadAccess(this), startupData))); | 185 backingThread().postTask(FROM_HERE, new Task(threadSafeBind(&WorkerThread::i nitialize, AllowCrossThreadAccess(this), startupData))); |
| 185 } | 186 } |
| 186 | 187 |
| 187 void WorkerThread::interruptAndDispatchInspectorCommands() | 188 void WorkerThread::interruptAndDispatchInspectorCommands() |
| 188 { | 189 { |
| 189 MutexLocker locker(m_workerInspectorControllerMutex); | 190 MutexLocker locker(m_workerInspectorControllerMutex); |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 281 | 282 |
| 282 // Notify the proxy that the WorkerGlobalScope has been disposed of. | 283 // Notify the proxy that the WorkerGlobalScope has been disposed of. |
| 283 // This can free this thread object, hence it must not be touched afterwards . | 284 // This can free this thread object, hence it must not be touched afterwards . |
| 284 workerReportingProxy().workerThreadTerminated(); | 285 workerReportingProxy().workerThreadTerminated(); |
| 285 | 286 |
| 286 m_terminationEvent->signal(); | 287 m_terminationEvent->signal(); |
| 287 } | 288 } |
| 288 | 289 |
| 289 void WorkerThread::terminate() | 290 void WorkerThread::terminate() |
| 290 { | 291 { |
| 292 ASSERT(isMainThread()); | |
|
kinuko
2015/06/12 05:48:03
Should this rather be in terminateInternal() ?
Takashi Toyoshima
2015/06/15 05:01:03
Done.
| |
| 291 // Prevent the deadlock between GC and an attempt to terminate a thread. | 293 // Prevent the deadlock between GC and an attempt to terminate a thread. |
| 292 SafePointScope safePointScope(ThreadState::HeapPointersOnStack); | 294 SafePointScope safePointScope(ThreadState::HeapPointersOnStack); |
| 293 terminateInternal(); | 295 terminateInternal(); |
| 294 } | 296 } |
| 295 | 297 |
| 296 void WorkerThread::terminateAndWait() | 298 void WorkerThread::terminateAndWait() |
| 297 { | 299 { |
| 298 terminate(); | 300 terminate(); |
| 299 m_terminationEvent->wait(); | 301 m_terminationEvent->wait(); |
| 300 } | 302 } |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 483 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 485 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
| 484 } | 486 } |
| 485 | 487 |
| 486 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) | 488 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke rInspectorController) |
| 487 { | 489 { |
| 488 MutexLocker locker(m_workerInspectorControllerMutex); | 490 MutexLocker locker(m_workerInspectorControllerMutex); |
| 489 m_workerInspectorController = workerInspectorController; | 491 m_workerInspectorController = workerInspectorController; |
| 490 } | 492 } |
| 491 | 493 |
| 492 } // namespace blink | 494 } // namespace blink |
| OLD | NEW |