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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 void WorkerThread::start(std::unique_ptr<WorkerThreadStartupData> startupData) { | 107 void WorkerThread::start(std::unique_ptr<WorkerThreadStartupData> startupData) { |
108 DCHECK(isMainThread()); | 108 DCHECK(isMainThread()); |
109 | 109 |
110 if (m_requestedToStart) | 110 if (m_requestedToStart) |
111 return; | 111 return; |
112 | 112 |
113 m_requestedToStart = true; | 113 m_requestedToStart = true; |
114 workerBackingThread().backingThread().postTask( | 114 workerBackingThread().backingThread().postTask( |
115 BLINK_FROM_HERE, crossThreadBind(&WorkerThread::initializeOnWorkerThread, | 115 BLINK_FROM_HERE, |
116 crossThreadUnretained(this), | 116 crossThreadBind(&WorkerThread::initializeOnWorkerThread, |
117 WTF::passed(std::move(startupData)))); | 117 crossThreadUnretained(this), |
| 118 WTF::passed(std::move(startupData)))); |
118 } | 119 } |
119 | 120 |
120 void WorkerThread::terminate() { | 121 void WorkerThread::terminate() { |
121 DCHECK(isMainThread()); | 122 DCHECK(isMainThread()); |
122 terminateInternal(TerminationMode::Graceful); | 123 terminateInternal(TerminationMode::Graceful); |
123 } | 124 } |
124 | 125 |
125 void WorkerThread::terminateAndWait() { | 126 void WorkerThread::terminateAndWait() { |
126 DCHECK(isMainThread()); | 127 DCHECK(isMainThread()); |
127 | 128 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 | 187 |
187 bool WorkerThread::isCurrentThread() { | 188 bool WorkerThread::isCurrentThread() { |
188 return workerBackingThread().backingThread().isCurrentThread(); | 189 return workerBackingThread().backingThread().isCurrentThread(); |
189 } | 190 } |
190 | 191 |
191 void WorkerThread::postTask(const WebTraceLocation& location, | 192 void WorkerThread::postTask(const WebTraceLocation& location, |
192 std::unique_ptr<WTF::CrossThreadClosure> task) { | 193 std::unique_ptr<WTF::CrossThreadClosure> task) { |
193 if (isInShutdown()) | 194 if (isInShutdown()) |
194 return; | 195 return; |
195 workerBackingThread().backingThread().postTask( | 196 workerBackingThread().backingThread().postTask( |
196 location, crossThreadBind(&WorkerThread::performTaskOnWorkerThread, | 197 location, |
197 crossThreadUnretained(this), | 198 crossThreadBind(&WorkerThread::performTaskOnWorkerThread, |
198 WTF::passed(std::move(task)))); | 199 crossThreadUnretained(this), |
| 200 WTF::passed(std::move(task)))); |
199 } | 201 } |
200 | 202 |
201 void WorkerThread::appendDebuggerTask( | 203 void WorkerThread::appendDebuggerTask( |
202 std::unique_ptr<CrossThreadClosure> task) { | 204 std::unique_ptr<CrossThreadClosure> task) { |
203 DCHECK(isMainThread()); | 205 DCHECK(isMainThread()); |
204 if (isInShutdown()) | 206 if (isInShutdown()) |
205 return; | 207 return; |
206 m_inspectorTaskRunner->appendTask(crossThreadBind( | 208 m_inspectorTaskRunner->appendTask(crossThreadBind( |
207 &WorkerThread::performDebuggerTaskOnWorkerThread, | 209 &WorkerThread::performDebuggerTaskOnWorkerThread, |
208 crossThreadUnretained(this), WTF::passed(std::move(task)))); | 210 crossThreadUnretained(this), WTF::passed(std::move(task)))); |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
645 MutexLocker lock(m_threadStateMutex); | 647 MutexLocker lock(m_threadStateMutex); |
646 return m_requestedToTerminate; | 648 return m_requestedToTerminate; |
647 } | 649 } |
648 | 650 |
649 ExitCode WorkerThread::getExitCodeForTesting() { | 651 ExitCode WorkerThread::getExitCodeForTesting() { |
650 MutexLocker lock(m_threadStateMutex); | 652 MutexLocker lock(m_threadStateMutex); |
651 return m_exitCode; | 653 return m_exitCode; |
652 } | 654 } |
653 | 655 |
654 } // namespace blink | 656 } // namespace blink |
OLD | NEW |