Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Unified Diff: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp

Issue 2066403003: Revert of Remove WorkerBackingThread::scriptCount (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
diff --git a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
index 0d13f195d720cc210e194a71f8927b1815b017aa..ff81557e42cdc4de5d0bc6b1db5152c6af55c88e 100644
--- a/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
+++ b/third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp
@@ -104,6 +104,7 @@
void TearDown() override
{
m_page.reset();
+ CompositorWorkerThread::terminateExecution();
CompositorWorkerThread::clearSharedBackingThread();
}
@@ -139,6 +140,7 @@
private:
void executeScriptInWorker(WorkerThread* worker, WaitableEvent* waitEvent)
{
+ EXPECT_GT(worker->workerBackingThread().workerScriptCount(), 0u);
WorkerOrWorkletScriptController* scriptController = worker->workerGlobalScope()->scriptController();
bool evaluateResult = scriptController->evaluate(ScriptSourceCode("var counter = 0; ++counter;"));
ASSERT_UNUSED(evaluateResult, evaluateResult);
@@ -170,9 +172,7 @@
// Create the second worker and immediately destroy the first worker.
OwnPtr<CompositorWorkerThread> secondWorker = createCompositorWorker();
- // We don't use terminateAndWait here to avoid forcible termination.
- firstWorker->terminate();
- firstWorker->waitForShutdownForTesting();
+ firstWorker->terminateAndWait();
// Wait until the second worker is initialized. Verify that the second worker is using the same
// thread and Isolate as the first worker.
@@ -194,18 +194,21 @@
{
// Create the first worker, wait until it is initialized, and terminate it.
OwnPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker();
+ WorkerBackingThread* workerBackingThread = &compositorWorker->workerBackingThread();
WebThreadSupportingGC* firstThread = &compositorWorker->workerBackingThread().backingThread();
checkWorkerCanExecuteScript(compositorWorker.get());
- // We don't use terminateAndWait here to avoid forcible termination.
- compositorWorker->terminate();
- compositorWorker->waitForShutdownForTesting();
+ ASSERT_EQ(2u, workerBackingThread->workerScriptCount());
+ compositorWorker->terminateAndWait();
+
+ ASSERT_EQ(1u, workerBackingThread->workerScriptCount());
// Create the second worker. The backing thread is same.
compositorWorker = createCompositorWorker();
WebThreadSupportingGC* secondThread = &compositorWorker->workerBackingThread().backingThread();
EXPECT_EQ(firstThread, secondThread);
checkWorkerCanExecuteScript(compositorWorker.get());
+ ASSERT_EQ(2u, workerBackingThread->workerScriptCount());
compositorWorker->terminateAndWait();
}
@@ -220,6 +223,7 @@
// Request termination of the first worker and create the second worker
// as soon as possible.
+ EXPECT_EQ(2u, firstWorker->workerBackingThread().workerScriptCount());
firstWorker->terminate();
// We don't wait for its termination.
// Note: We rely on the assumption that the termination steps don't run
« no previous file with comments | « third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThread.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698