| 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()); |
| 181 |
| 180 if (m_started) | 182 if (m_started) |
| 181 return; | 183 return; |
| 182 | 184 |
| 183 m_started = true; | 185 m_started = true; |
| 184 backingThread().postTask(FROM_HERE, new Task(threadSafeBind(&WorkerThread::i
nitialize, AllowCrossThreadAccess(this), startupData))); | 186 backingThread().postTask(FROM_HERE, new Task(threadSafeBind(&WorkerThread::i
nitialize, AllowCrossThreadAccess(this), startupData))); |
| 185 } | 187 } |
| 186 | 188 |
| 187 void WorkerThread::interruptAndDispatchInspectorCommands() | 189 void WorkerThread::interruptAndDispatchInspectorCommands() |
| 188 { | 190 { |
| 189 MutexLocker locker(m_workerInspectorControllerMutex); | 191 MutexLocker locker(m_workerInspectorControllerMutex); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 } | 302 } |
| 301 | 303 |
| 302 bool WorkerThread::terminated() | 304 bool WorkerThread::terminated() |
| 303 { | 305 { |
| 304 MutexLocker lock(m_threadStateMutex); | 306 MutexLocker lock(m_threadStateMutex); |
| 305 return m_terminated; | 307 return m_terminated; |
| 306 } | 308 } |
| 307 | 309 |
| 308 void WorkerThread::terminateInternal() | 310 void WorkerThread::terminateInternal() |
| 309 { | 311 { |
| 312 ASSERT(isMainThread()); |
| 313 |
| 310 // Protect against this method, initialize() or termination via the global s
cope racing each other. | 314 // Protect against this method, initialize() or termination via the global s
cope racing each other. |
| 311 MutexLocker lock(m_threadStateMutex); | 315 MutexLocker lock(m_threadStateMutex); |
| 312 | 316 |
| 313 // If terminateInternal has already been called, just return. | 317 // If terminateInternal has already been called, just return. |
| 314 if (m_terminated) | 318 if (m_terminated) |
| 315 return; | 319 return; |
| 316 m_terminated = true; | 320 m_terminated = true; |
| 317 | 321 |
| 318 // Signal the thread to notify that the thread's stopping. | 322 // Signal the thread to notify that the thread's stopping. |
| 319 if (m_shutdownEvent) | 323 if (m_shutdownEvent) |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); | 487 InspectorInstrumentation::didLeaveNestedRunLoop(m_workerGlobalScope.get()); |
| 484 } | 488 } |
| 485 | 489 |
| 486 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) | 490 void WorkerThread::setWorkerInspectorController(WorkerInspectorController* worke
rInspectorController) |
| 487 { | 491 { |
| 488 MutexLocker locker(m_workerInspectorControllerMutex); | 492 MutexLocker locker(m_workerInspectorControllerMutex); |
| 489 m_workerInspectorController = workerInspectorController; | 493 m_workerInspectorController = workerInspectorController; |
| 490 } | 494 } |
| 491 | 495 |
| 492 } // namespace blink | 496 } // namespace blink |
| OLD | NEW |