| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/workers/WorkerThread.h" | 5 #include "core/workers/WorkerThread.h" |
| 6 | 6 |
| 7 #include "core/workers/WorkerThreadTestHelper.h" | 7 #include "core/workers/WorkerThreadTestHelper.h" |
| 8 #include "platform/testing/UnitTestHelpers.h" | 8 #include "platform/testing/UnitTestHelpers.h" |
| 9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 nullptr, /* cachedMetaData */ | 182 nullptr, /* cachedMetaData */ |
| 183 PauseWorkerGlobalScopeOnStart, | 183 PauseWorkerGlobalScopeOnStart, |
| 184 headers.get(), | 184 headers.get(), |
| 185 m_securityOrigin.get(), | 185 m_securityOrigin.get(), |
| 186 nullptr, /* workerClients */ | 186 nullptr, /* workerClients */ |
| 187 WebAddressSpaceLocal, | 187 WebAddressSpaceLocal, |
| 188 nullptr /* originTrialToken */, | 188 nullptr /* originTrialToken */, |
| 189 V8CacheOptionsDefault); | 189 V8CacheOptionsDefault); |
| 190 m_workerThread->start(std::move(startupData)); | 190 m_workerThread->start(std::move(startupData)); |
| 191 | 191 |
| 192 m_workerThread->appendDebuggerTask(threadSafeBind(&waitForTermination, Allow
CrossThreadAccess(m_workerThread.get()))); | 192 m_workerThread->appendDebuggerTask(threadSafeBind(&waitForTermination, cross
ThreadUnretained(m_workerThread.get()))); |
| 193 | 193 |
| 194 // Wait for the debugger task. | 194 // Wait for the debugger task. |
| 195 testing::enterRunLoop(); | 195 testing::enterRunLoop(); |
| 196 | 196 |
| 197 // Start termination while the debugger task is running. | 197 // Start termination while the debugger task is running. |
| 198 EXPECT_TRUE(m_workerThread->m_runningDebuggerTask); | 198 EXPECT_TRUE(m_workerThread->m_runningDebuggerTask); |
| 199 m_workerThread->terminateAndWait(); | 199 m_workerThread->terminateAndWait(); |
| 200 EXPECT_EQ(WorkerThread::ExitCode::GracefullyTerminated, m_workerThread->getE
xitCode()); | 200 EXPECT_EQ(WorkerThread::ExitCode::GracefullyTerminated, m_workerThread->getE
xitCode()); |
| 201 } | 201 } |
| 202 | 202 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 | 305 |
| 306 // Clean up in order to satisfy DCHECKs in dtors. | 306 // Clean up in order to satisfy DCHECKs in dtors. |
| 307 m_workerThread->m_runningDebuggerTask = false; | 307 m_workerThread->m_runningDebuggerTask = false; |
| 308 m_workerThread->forciblyTerminateExecution(); | 308 m_workerThread->forciblyTerminateExecution(); |
| 309 m_workerThread->waitForShutdownForTesting(); | 309 m_workerThread->waitForShutdownForTesting(); |
| 310 } | 310 } |
| 311 | 311 |
| 312 // TODO(nhiroki): Add tests for terminateAndWaitForAllWorkers. | 312 // TODO(nhiroki): Add tests for terminateAndWaitForAllWorkers. |
| 313 | 313 |
| 314 } // namespace blink | 314 } // namespace blink |
| OLD | NEW |