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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 WorkerInspectorController* WorkerThread::workerInspectorController() { | 313 WorkerInspectorController* WorkerThread::workerInspectorController() { |
| 314 DCHECK(isCurrentThread()); | 314 DCHECK(isCurrentThread()); |
| 315 return m_workerInspectorController.get(); | 315 return m_workerInspectorController.get(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 unsigned WorkerThread::workerThreadCount() { | 318 unsigned WorkerThread::workerThreadCount() { |
| 319 MutexLocker lock(threadSetMutex()); | 319 MutexLocker lock(threadSetMutex()); |
| 320 return workerThreads().size(); | 320 return workerThreads().size(); |
| 321 } | 321 } |
| 322 | 322 |
| 323 void WorkerThread::PostTaskToAllWorkerThreads( | |
| 324 const WebTraceLocation& location, | |
| 325 std::unique_ptr<ExecutionContextTask> task) { | |
| 326 MutexLocker lock(threadSetMutex()); | |
| 327 HashSet<WorkerThread*> threads = workerThreads(); | |
| 328 | |
| 329 for (WorkerThread* thread : threads) { | |
| 330 if (thread->isOwningBackingThread()) | |
|
nhiroki
2016/10/13 10:24:12
isOwningBackingThread() returns true when this Wor
leonhsl(Using Gerrit)
2016/10/14 03:12:00
Oh,, I misunderstood that isOwningBackingThread()
nhiroki
2016/10/17 03:49:11
Yeah..., this is so confusing.
To be more precise
leonhsl(Using Gerrit)
2016/10/17 07:30:01
Done. Thank you very much for sharing the details
| |
| 331 thread->postTask(location, std::move(task)); | |
|
nhiroki
2016/10/13 10:24:12
|task| is moved here, so you can't use it on follo
leonhsl(Using Gerrit)
2016/10/14 03:12:00
My bad.. Thanks!
| |
| 332 } | |
| 333 } | |
| 334 | |
| 323 PlatformThreadId WorkerThread::platformThreadId() { | 335 PlatformThreadId WorkerThread::platformThreadId() { |
| 324 if (!m_requestedToStart) | 336 if (!m_requestedToStart) |
| 325 return 0; | 337 return 0; |
| 326 return workerBackingThread().backingThread().platformThread().threadId(); | 338 return workerBackingThread().backingThread().platformThread().threadId(); |
| 327 } | 339 } |
| 328 | 340 |
| 329 bool WorkerThread::isForciblyTerminated() { | 341 bool WorkerThread::isForciblyTerminated() { |
| 330 MutexLocker lock(m_threadStateMutex); | 342 MutexLocker lock(m_threadStateMutex); |
| 331 switch (m_exitCode) { | 343 switch (m_exitCode) { |
| 332 case ExitCode::NotTerminated: | 344 case ExitCode::NotTerminated: |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 685 MutexLocker lock(m_threadStateMutex); | 697 MutexLocker lock(m_threadStateMutex); |
| 686 return m_requestedToTerminate; | 698 return m_requestedToTerminate; |
| 687 } | 699 } |
| 688 | 700 |
| 689 ExitCode WorkerThread::getExitCodeForTesting() { | 701 ExitCode WorkerThread::getExitCodeForTesting() { |
| 690 MutexLocker lock(m_threadStateMutex); | 702 MutexLocker lock(m_threadStateMutex); |
| 691 return m_exitCode; | 703 return m_exitCode; |
| 692 } | 704 } |
| 693 | 705 |
| 694 } // namespace blink | 706 } // namespace blink |
| OLD | NEW |