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

Side by Side Diff: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp

Issue 1682423002: Remove WebWaitableEvent and replace it with WaitableEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix android build Created 4 years, 10 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 unified diff | Download patch
OLDNEW
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 "modules/compositorworker/CompositorWorkerThread.h" 5 #include "modules/compositorworker/CompositorWorkerThread.h"
6 6
7 #include "bindings/core/v8/ScriptSourceCode.h" 7 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "bindings/core/v8/V8GCController.h" 8 #include "bindings/core/v8/V8GCController.h"
9 #include "core/inspector/ConsoleMessage.h" 9 #include "core/inspector/ConsoleMessage.h"
10 #include "core/testing/DummyPageHolder.h" 10 #include "core/testing/DummyPageHolder.h"
11 #include "core/workers/WorkerLoaderProxy.h" 11 #include "core/workers/WorkerLoaderProxy.h"
12 #include "core/workers/WorkerObjectProxy.h" 12 #include "core/workers/WorkerObjectProxy.h"
13 #include "core/workers/WorkerThreadStartupData.h" 13 #include "core/workers/WorkerThreadStartupData.h"
14 #include "platform/NotImplemented.h" 14 #include "platform/NotImplemented.h"
15 #include "platform/ThreadSafeFunctional.h" 15 #include "platform/ThreadSafeFunctional.h"
16 #include "platform/WaitableEvent.h"
16 #include "platform/heap/Handle.h" 17 #include "platform/heap/Handle.h"
17 #include "platform/testing/TestingPlatformSupport.h" 18 #include "platform/testing/TestingPlatformSupport.h"
18 #include "platform/testing/UnitTestHelpers.h" 19 #include "platform/testing/UnitTestHelpers.h"
19 #include "public/platform/Platform.h" 20 #include "public/platform/Platform.h"
20 #include "public/platform/WebWaitableEvent.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 namespace blink { 23 namespace blink {
24 namespace { 24 namespace {
25 25
26 class TestCompositorWorkerThread : public CompositorWorkerThread { 26 class TestCompositorWorkerThread : public CompositorWorkerThread {
27 public: 27 public:
28 TestCompositorWorkerThread(WorkerLoaderProxyProvider* loaderProxyProvider, W orkerObjectProxy& objectProxy, double timeOrigin, WebWaitableEvent* startEvent) 28 TestCompositorWorkerThread(WorkerLoaderProxyProvider* loaderProxyProvider, W orkerObjectProxy& objectProxy, double timeOrigin, WaitableEvent* startEvent)
29 : CompositorWorkerThread(WorkerLoaderProxy::create(loaderProxyProvider), objectProxy, timeOrigin) 29 : CompositorWorkerThread(WorkerLoaderProxy::create(loaderProxyProvider), objectProxy, timeOrigin)
30 , m_startEvent(startEvent) 30 , m_startEvent(startEvent)
31 { 31 {
32 } 32 }
33 33
34 ~TestCompositorWorkerThread() override {} 34 ~TestCompositorWorkerThread() override {}
35 35
36 void setCallbackAfterV8Termination(PassOwnPtr<Function<void()>> callback) 36 void setCallbackAfterV8Termination(PassOwnPtr<Function<void()>> callback)
37 { 37 {
38 m_v8TerminationCallback = callback; 38 m_v8TerminationCallback = callback;
(...skipping 12 matching lines...) Expand all
51 (*m_v8TerminationCallback)(); 51 (*m_v8TerminationCallback)();
52 } 52 }
53 53
54 void willDestroyIsolate() override 54 void willDestroyIsolate() override
55 { 55 {
56 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting(v8::Isolat e::kFullGarbageCollection); 56 v8::Isolate::GetCurrent()->RequestGarbageCollectionForTesting(v8::Isolat e::kFullGarbageCollection);
57 Heap::collectAllGarbage(); 57 Heap::collectAllGarbage();
58 CompositorWorkerThread::willDestroyIsolate(); 58 CompositorWorkerThread::willDestroyIsolate();
59 } 59 }
60 60
61 WebWaitableEvent* m_startEvent; 61 WaitableEvent* m_startEvent;
62 OwnPtr<Function<void()>> m_v8TerminationCallback; 62 OwnPtr<Function<void()>> m_v8TerminationCallback;
63 }; 63 };
64 64
65 // A null WorkerObjectProxy, supplied when creating CompositorWorkerThreads. 65 // A null WorkerObjectProxy, supplied when creating CompositorWorkerThreads.
66 class TestCompositorWorkerObjectProxy : public WorkerObjectProxy { 66 class TestCompositorWorkerObjectProxy : public WorkerObjectProxy {
67 public: 67 public:
68 static PassOwnPtr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context) 68 static PassOwnPtr<TestCompositorWorkerObjectProxy> create(ExecutionContext* context)
69 { 69 {
70 return adoptPtr(new TestCompositorWorkerObjectProxy(context)); 70 return adoptPtr(new TestCompositorWorkerObjectProxy(context));
71 } 71 }
(...skipping 27 matching lines...) Expand all
99 CompositorWorkerTestPlatform() 99 CompositorWorkerTestPlatform()
100 : m_thread(adoptPtr(m_oldPlatform->createThread("Compositor"))) 100 : m_thread(adoptPtr(m_oldPlatform->createThread("Compositor")))
101 { 101 {
102 } 102 }
103 103
104 WebThread* compositorThread() const override 104 WebThread* compositorThread() const override
105 { 105 {
106 return m_thread.get(); 106 return m_thread.get();
107 } 107 }
108 108
109 WebWaitableEvent* createWaitableEvent(
110 WebWaitableEvent::ResetPolicy policy,
111 WebWaitableEvent::InitialState state) override
112 {
113 return m_oldPlatform->createWaitableEvent(policy, state);
114 }
115
116 WebCompositorSupport* compositorSupport() override { return &m_compositorSup port; } 109 WebCompositorSupport* compositorSupport() override { return &m_compositorSup port; }
117 110
118 private: 111 private:
119 OwnPtr<WebThread> m_thread; 112 OwnPtr<WebThread> m_thread;
120 TestingCompositorSupport m_compositorSupport; 113 TestingCompositorSupport m_compositorSupport;
121 }; 114 };
122 115
123 } // namespace 116 } // namespace
124 117
125 class CompositorWorkerThreadTest : public ::testing::Test { 118 class CompositorWorkerThreadTest : public ::testing::Test {
126 public: 119 public:
127 void SetUp() override 120 void SetUp() override
128 { 121 {
129 m_page = DummyPageHolder::create(); 122 m_page = DummyPageHolder::create();
130 m_objectProxy = TestCompositorWorkerObjectProxy::create(&m_page->documen t()); 123 m_objectProxy = TestCompositorWorkerObjectProxy::create(&m_page->documen t());
131 m_securityOrigin = SecurityOrigin::create(KURL(ParsedURLString, "http:// fake.url/")); 124 m_securityOrigin = SecurityOrigin::create(KURL(ParsedURLString, "http:// fake.url/"));
132 } 125 }
133 126
134 void TearDown() override 127 void TearDown() override
135 { 128 {
136 ASSERT(!hasThread()); 129 ASSERT(!hasThread());
137 ASSERT(!hasIsolate()); 130 ASSERT(!hasIsolate());
138 m_page.clear(); 131 m_page.clear();
139 } 132 }
140 133
141 PassRefPtr<TestCompositorWorkerThread> createCompositorWorker(WebWaitableEve nt* startEvent) 134 PassRefPtr<TestCompositorWorkerThread> createCompositorWorker(WaitableEvent* startEvent)
142 { 135 {
143 TestCompositorWorkerThread* workerThread = new TestCompositorWorkerThrea d(nullptr, *m_objectProxy, 0, startEvent); 136 TestCompositorWorkerThread* workerThread = new TestCompositorWorkerThrea d(nullptr, *m_objectProxy, 0, startEvent);
144 OwnPtrWillBeRawPtr<WorkerClients> clients = nullptr; 137 OwnPtrWillBeRawPtr<WorkerClients> clients = nullptr;
145 workerThread->start(WorkerThreadStartupData::create( 138 workerThread->start(WorkerThreadStartupData::create(
146 KURL(ParsedURLString, "http://fake.url/"), 139 KURL(ParsedURLString, "http://fake.url/"),
147 "fake user agent", 140 "fake user agent",
148 "//fake source code", 141 "//fake source code",
149 nullptr, 142 nullptr,
150 DontPauseWorkerGlobalScopeOnStart, 143 DontPauseWorkerGlobalScopeOnStart,
151 adoptPtr(new Vector<CSPHeaderAndType>()), 144 adoptPtr(new Vector<CSPHeaderAndType>()),
152 m_securityOrigin.get(), 145 m_securityOrigin.get(),
153 clients.release(), 146 clients.release(),
154 V8CacheOptionsDefault)); 147 V8CacheOptionsDefault));
155 return adoptRef(workerThread); 148 return adoptRef(workerThread);
156 } 149 }
157 150
158 void createWorkerAdapter(RefPtr<CompositorWorkerThread>* workerThread, WebWa itableEvent* creationEvent) 151 void createWorkerAdapter(RefPtr<CompositorWorkerThread>* workerThread, Waita bleEvent* creationEvent)
159 { 152 {
160 *workerThread = createCompositorWorker(creationEvent); 153 *workerThread = createCompositorWorker(creationEvent);
161 } 154 }
162 155
163 // Attempts to run some simple script for |worker|. 156 // Attempts to run some simple script for |worker|.
164 void checkWorkerCanExecuteScript(WorkerThread* worker) 157 void checkWorkerCanExecuteScript(WorkerThread* worker)
165 { 158 {
166 OwnPtr<WebWaitableEvent> waitEvent = adoptPtr(Platform::current()->creat eWaitableEvent()); 159 OwnPtr<WaitableEvent> waitEvent = adoptPtr(new WaitableEvent());
167 worker->backingThread().platformThread().taskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, Allo wCrossThreadAccess(this), 160 worker->backingThread().platformThread().taskRunner()->postTask(BLINK_FR OM_HERE, threadSafeBind(&CompositorWorkerThreadTest::executeScriptInWorker, Allo wCrossThreadAccess(this),
168 AllowCrossThreadAccess(worker), AllowCrossThreadAccess(waitEvent.get ()))); 161 AllowCrossThreadAccess(worker), AllowCrossThreadAccess(waitEvent.get ())));
169 waitEvent->wait(); 162 waitEvent->wait();
170 } 163 }
171 164
172 void waitForWaitableEventAfterIteratingCurrentLoop(WebWaitableEvent* waitEve nt) 165 void waitForWaitableEventAfterIteratingCurrentLoop(WaitableEvent* waitEvent)
173 { 166 {
174 testing::runPendingTasks(); 167 testing::runPendingTasks();
175 waitEvent->wait(); 168 waitEvent->wait();
176 } 169 }
177 170
178 bool hasThread() const 171 bool hasThread() const
179 { 172 {
180 return CompositorWorkerThread::hasThreadForTest(); 173 return CompositorWorkerThread::hasThreadForTest();
181 } 174 }
182 175
183 bool hasIsolate() const 176 bool hasIsolate() const
184 { 177 {
185 return CompositorWorkerThread::hasIsolateForTest(); 178 return CompositorWorkerThread::hasIsolateForTest();
186 } 179 }
187 180
188 private: 181 private:
189 void executeScriptInWorker(WorkerThread* worker, WebWaitableEvent* waitEvent ) 182 void executeScriptInWorker(WorkerThread* worker, WaitableEvent* waitEvent)
190 { 183 {
191 WorkerOrWorkletScriptController* scriptController = worker->workerGlobal Scope()->script(); 184 WorkerOrWorkletScriptController* scriptController = worker->workerGlobal Scope()->script();
192 bool evaluateResult = scriptController->evaluate(ScriptSourceCode("var c ounter = 0; ++counter;")); 185 bool evaluateResult = scriptController->evaluate(ScriptSourceCode("var c ounter = 0; ++counter;"));
193 ASSERT_UNUSED(evaluateResult, evaluateResult); 186 ASSERT_UNUSED(evaluateResult, evaluateResult);
194 waitEvent->signal(); 187 waitEvent->signal();
195 } 188 }
196 189
197 OwnPtr<DummyPageHolder> m_page; 190 OwnPtr<DummyPageHolder> m_page;
198 RefPtr<SecurityOrigin> m_securityOrigin; 191 RefPtr<SecurityOrigin> m_securityOrigin;
199 OwnPtr<WorkerObjectProxy> m_objectProxy; 192 OwnPtr<WorkerObjectProxy> m_objectProxy;
200 CompositorWorkerTestPlatform m_testPlatform; 193 CompositorWorkerTestPlatform m_testPlatform;
201 }; 194 };
202 195
203 TEST_F(CompositorWorkerThreadTest, Basic) 196 TEST_F(CompositorWorkerThreadTest, Basic)
204 { 197 {
205 OwnPtr<WebWaitableEvent> creationEvent = adoptPtr(Platform::current()->creat eWaitableEvent()); 198 OwnPtr<WaitableEvent> creationEvent = adoptPtr(new WaitableEvent());
206 RefPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker(cre ationEvent.get()); 199 RefPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker(cre ationEvent.get());
207 waitForWaitableEventAfterIteratingCurrentLoop(creationEvent.get()); 200 waitForWaitableEventAfterIteratingCurrentLoop(creationEvent.get());
208 checkWorkerCanExecuteScript(compositorWorker.get()); 201 checkWorkerCanExecuteScript(compositorWorker.get());
209 compositorWorker->terminateAndWait(); 202 compositorWorker->terminateAndWait();
210 } 203 }
211 204
212 // Tests that the same WebThread is used for new workers if the WebThread is sti ll alive. 205 // Tests that the same WebThread is used for new workers if the WebThread is sti ll alive.
213 TEST_F(CompositorWorkerThreadTest, CreateSecondAndTerminateFirst) 206 TEST_F(CompositorWorkerThreadTest, CreateSecondAndTerminateFirst)
214 { 207 {
215 // Create the first worker and wait until it is initialized. 208 // Create the first worker and wait until it is initialized.
216 OwnPtr<WebWaitableEvent> firstCreationEvent = adoptPtr(Platform::current()-> createWaitableEvent()); 209 OwnPtr<WaitableEvent> firstCreationEvent = adoptPtr(new WaitableEvent());
217 RefPtr<CompositorWorkerThread> firstWorker = createCompositorWorker(firstCre ationEvent.get()); 210 RefPtr<CompositorWorkerThread> firstWorker = createCompositorWorker(firstCre ationEvent.get());
218 WebThreadSupportingGC* firstThread = CompositorWorkerThread::sharedBackingTh read(); 211 WebThreadSupportingGC* firstThread = CompositorWorkerThread::sharedBackingTh read();
219 ASSERT(firstThread); 212 ASSERT(firstThread);
220 waitForWaitableEventAfterIteratingCurrentLoop(firstCreationEvent.get()); 213 waitForWaitableEventAfterIteratingCurrentLoop(firstCreationEvent.get());
221 v8::Isolate* firstIsolate = firstWorker->isolate(); 214 v8::Isolate* firstIsolate = firstWorker->isolate();
222 ASSERT(firstIsolate); 215 ASSERT(firstIsolate);
223 216
224 // Create the second worker and immediately destroy the first worker. 217 // Create the second worker and immediately destroy the first worker.
225 OwnPtr<WebWaitableEvent> secondCreationEvent = adoptPtr(Platform::current()- >createWaitableEvent()); 218 OwnPtr<WaitableEvent> secondCreationEvent = adoptPtr(new WaitableEvent());
226 RefPtr<CompositorWorkerThread> secondWorker = createCompositorWorker(secondC reationEvent.get()); 219 RefPtr<CompositorWorkerThread> secondWorker = createCompositorWorker(secondC reationEvent.get());
227 firstWorker->terminateAndWait(); 220 firstWorker->terminateAndWait();
228 221
229 // Wait until the second worker is initialized. Verify that the second worke r is using the same 222 // Wait until the second worker is initialized. Verify that the second worke r is using the same
230 // thread and Isolate as the first worker. 223 // thread and Isolate as the first worker.
231 WebThreadSupportingGC* secondThread = CompositorWorkerThread::sharedBackingT hread(); 224 WebThreadSupportingGC* secondThread = CompositorWorkerThread::sharedBackingT hread();
232 ASSERT(secondThread); 225 ASSERT(secondThread);
233 waitForWaitableEventAfterIteratingCurrentLoop(secondCreationEvent.get()); 226 waitForWaitableEventAfterIteratingCurrentLoop(secondCreationEvent.get());
234 EXPECT_EQ(firstThread, secondThread); 227 EXPECT_EQ(firstThread, secondThread);
235 228
236 v8::Isolate* secondIsolate = secondWorker->isolate(); 229 v8::Isolate* secondIsolate = secondWorker->isolate();
237 ASSERT(secondIsolate); 230 ASSERT(secondIsolate);
238 EXPECT_EQ(firstIsolate, secondIsolate); 231 EXPECT_EQ(firstIsolate, secondIsolate);
239 232
240 // Verify that the worker can still successfully execute script. 233 // Verify that the worker can still successfully execute script.
241 checkWorkerCanExecuteScript(secondWorker.get()); 234 checkWorkerCanExecuteScript(secondWorker.get());
242 235
243 secondWorker->terminateAndWait(); 236 secondWorker->terminateAndWait();
244 } 237 }
245 238
246 static void checkCurrentIsolate(v8::Isolate* isolate, WebWaitableEvent* event) 239 static void checkCurrentIsolate(v8::Isolate* isolate, WaitableEvent* event)
247 { 240 {
248 EXPECT_EQ(v8::Isolate::GetCurrent(), isolate); 241 EXPECT_EQ(v8::Isolate::GetCurrent(), isolate);
249 event->signal(); 242 event->signal();
250 } 243 }
251 244
252 // Tests that a new WebThread is created if all existing workers are terminated before a new worker is created. 245 // Tests that a new WebThread is created if all existing workers are terminated before a new worker is created.
253 TEST_F(CompositorWorkerThreadTest, TerminateFirstAndCreateSecond) 246 TEST_F(CompositorWorkerThreadTest, TerminateFirstAndCreateSecond)
254 { 247 {
255 // Create the first worker, wait until it is initialized, and terminate it. 248 // Create the first worker, wait until it is initialized, and terminate it.
256 OwnPtr<WebWaitableEvent> creationEvent = adoptPtr(Platform::current()->creat eWaitableEvent()); 249 OwnPtr<WaitableEvent> creationEvent = adoptPtr(new WaitableEvent());
257 RefPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker(cre ationEvent.get()); 250 RefPtr<CompositorWorkerThread> compositorWorker = createCompositorWorker(cre ationEvent.get());
258 WebThreadSupportingGC* firstThread = CompositorWorkerThread::sharedBackingTh read(); 251 WebThreadSupportingGC* firstThread = CompositorWorkerThread::sharedBackingTh read();
259 waitForWaitableEventAfterIteratingCurrentLoop(creationEvent.get()); 252 waitForWaitableEventAfterIteratingCurrentLoop(creationEvent.get());
260 ASSERT(compositorWorker->isolate()); 253 ASSERT(compositorWorker->isolate());
261 compositorWorker->terminateAndWait(); 254 compositorWorker->terminateAndWait();
262 255
263 // Create the second worker. Verify that the second worker lives in a differ ent WebThread since the first 256 // Create the second worker. Verify that the second worker lives in a differ ent WebThread since the first
264 // thread will have been destroyed after destroying the first worker. 257 // thread will have been destroyed after destroying the first worker.
265 creationEvent = adoptPtr(Platform::current()->createWaitableEvent()); 258 creationEvent = adoptPtr(new WaitableEvent());
266 compositorWorker = createCompositorWorker(creationEvent.get()); 259 compositorWorker = createCompositorWorker(creationEvent.get());
267 WebThreadSupportingGC* secondThread = CompositorWorkerThread::sharedBackingT hread(); 260 WebThreadSupportingGC* secondThread = CompositorWorkerThread::sharedBackingT hread();
268 EXPECT_NE(firstThread, secondThread); 261 EXPECT_NE(firstThread, secondThread);
269 waitForWaitableEventAfterIteratingCurrentLoop(creationEvent.get()); 262 waitForWaitableEventAfterIteratingCurrentLoop(creationEvent.get());
270 263
271 // Jump over to the worker's thread to verify that the Isolate is set up cor rectly and execute script. 264 // Jump over to the worker's thread to verify that the Isolate is set up cor rectly and execute script.
272 OwnPtr<WebWaitableEvent> checkEvent = adoptPtr(Platform::current()->createWa itableEvent()); 265 OwnPtr<WaitableEvent> checkEvent = adoptPtr(new WaitableEvent());
273 secondThread->platformThread().taskRunner()->postTask(BLINK_FROM_HERE, threa dSafeBind(&checkCurrentIsolate, AllowCrossThreadAccess(compositorWorker->isolate ()), AllowCrossThreadAccess(checkEvent.get()))); 266 secondThread->platformThread().taskRunner()->postTask(BLINK_FROM_HERE, threa dSafeBind(&checkCurrentIsolate, AllowCrossThreadAccess(compositorWorker->isolate ()), AllowCrossThreadAccess(checkEvent.get())));
274 waitForWaitableEventAfterIteratingCurrentLoop(checkEvent.get()); 267 waitForWaitableEventAfterIteratingCurrentLoop(checkEvent.get());
275 checkWorkerCanExecuteScript(compositorWorker.get()); 268 checkWorkerCanExecuteScript(compositorWorker.get());
276 269
277 compositorWorker->terminateAndWait(); 270 compositorWorker->terminateAndWait();
278 } 271 }
279 272
280 // Tests that v8::Isolate and WebThread are correctly set-up if a worker is crea ted while another is terminating. 273 // Tests that v8::Isolate and WebThread are correctly set-up if a worker is crea ted while another is terminating.
281 TEST_F(CompositorWorkerThreadTest, CreatingSecondDuringTerminationOfFirst) 274 TEST_F(CompositorWorkerThreadTest, CreatingSecondDuringTerminationOfFirst)
282 { 275 {
283 OwnPtr<WebWaitableEvent> firstCreationEvent = adoptPtr(Platform::current()-> createWaitableEvent()); 276 OwnPtr<WaitableEvent> firstCreationEvent = adoptPtr(new WaitableEvent());
284 RefPtr<TestCompositorWorkerThread> firstWorker = createCompositorWorker(firs tCreationEvent.get()); 277 RefPtr<TestCompositorWorkerThread> firstWorker = createCompositorWorker(firs tCreationEvent.get());
285 waitForWaitableEventAfterIteratingCurrentLoop(firstCreationEvent.get()); 278 waitForWaitableEventAfterIteratingCurrentLoop(firstCreationEvent.get());
286 v8::Isolate* firstIsolate = firstWorker->isolate(); 279 v8::Isolate* firstIsolate = firstWorker->isolate();
287 ASSERT(firstIsolate); 280 ASSERT(firstIsolate);
288 281
289 // Request termination of the first worker, and set-up to make sure the seco nd worker is created right as 282 // Request termination of the first worker, and set-up to make sure the seco nd worker is created right as
290 // the first worker terminates its isolate. 283 // the first worker terminates its isolate.
291 OwnPtr<WebWaitableEvent> secondCreationEvent = adoptPtr(Platform::current()- >createWaitableEvent()); 284 OwnPtr<WaitableEvent> secondCreationEvent = adoptPtr(new WaitableEvent());
292 RefPtr<CompositorWorkerThread> secondWorker; 285 RefPtr<CompositorWorkerThread> secondWorker;
293 firstWorker->setCallbackAfterV8Termination(bind(&CompositorWorkerThreadTest: :createWorkerAdapter, this, &secondWorker, secondCreationEvent.get())); 286 firstWorker->setCallbackAfterV8Termination(bind(&CompositorWorkerThreadTest: :createWorkerAdapter, this, &secondWorker, secondCreationEvent.get()));
294 firstWorker->terminateAndWait(); 287 firstWorker->terminateAndWait();
295 ASSERT(secondWorker); 288 ASSERT(secondWorker);
296 289
297 waitForWaitableEventAfterIteratingCurrentLoop(secondCreationEvent.get()); 290 waitForWaitableEventAfterIteratingCurrentLoop(secondCreationEvent.get());
298 v8::Isolate* secondIsolate = secondWorker->isolate(); 291 v8::Isolate* secondIsolate = secondWorker->isolate();
299 ASSERT(secondIsolate); 292 ASSERT(secondIsolate);
300 EXPECT_EQ(firstIsolate, secondIsolate); 293 EXPECT_EQ(firstIsolate, secondIsolate);
301 294
302 // Verify that the isolate can run some scripts correctly in the second work er. 295 // Verify that the isolate can run some scripts correctly in the second work er.
303 checkWorkerCanExecuteScript(secondWorker.get()); 296 checkWorkerCanExecuteScript(secondWorker.get());
304 secondWorker->terminateAndWait(); 297 secondWorker->terminateAndWait();
305 } 298 }
306 299
307 } // namespace blink 300 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698