| 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 "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/SourceLocation.h" | 8 #include "bindings/core/v8/SourceLocation.h" |
| 9 #include "bindings/core/v8/V8GCController.h" | 9 #include "bindings/core/v8/V8GCController.h" |
| 10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" | 10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 workerThread->start(WorkerThreadStartupData::create( | 124 workerThread->start(WorkerThreadStartupData::create( |
| 125 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", | 125 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", |
| 126 "//fake source code", nullptr, DontPauseWorkerGlobalScopeOnStart, | 126 "//fake source code", nullptr, DontPauseWorkerGlobalScopeOnStart, |
| 127 nullptr, "", m_securityOrigin.get(), clients, WebAddressSpaceLocal, | 127 nullptr, "", m_securityOrigin.get(), clients, WebAddressSpaceLocal, |
| 128 nullptr, nullptr, V8CacheOptionsDefault)); | 128 nullptr, nullptr, V8CacheOptionsDefault)); |
| 129 return workerThread; | 129 return workerThread; |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Attempts to run some simple script for |worker|. | 132 // Attempts to run some simple script for |worker|. |
| 133 void checkWorkerCanExecuteScript(WorkerThread* worker) { | 133 void checkWorkerCanExecuteScript(WorkerThread* worker) { |
| 134 std::unique_ptr<WaitableEvent> waitEvent = wrapUnique(new WaitableEvent()); | 134 std::unique_ptr<WaitableEvent> waitEvent = makeUnique<WaitableEvent>(); |
| 135 worker->workerBackingThread().backingThread().postTask( | 135 worker->workerBackingThread().backingThread().postTask( |
| 136 BLINK_FROM_HERE, | 136 BLINK_FROM_HERE, |
| 137 crossThreadBind(&CompositorWorkerThreadTest::executeScriptInWorker, | 137 crossThreadBind(&CompositorWorkerThreadTest::executeScriptInWorker, |
| 138 crossThreadUnretained(this), | 138 crossThreadUnretained(this), |
| 139 crossThreadUnretained(worker), | 139 crossThreadUnretained(worker), |
| 140 crossThreadUnretained(waitEvent.get()))); | 140 crossThreadUnretained(waitEvent.get()))); |
| 141 waitEvent->wait(); | 141 waitEvent->wait(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 private: | 144 private: |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 ASSERT_TRUE(secondIsolate); | 246 ASSERT_TRUE(secondIsolate); |
| 247 EXPECT_EQ(firstIsolate, secondIsolate); | 247 EXPECT_EQ(firstIsolate, secondIsolate); |
| 248 | 248 |
| 249 // Verify that the isolate can run some scripts correctly in the second | 249 // Verify that the isolate can run some scripts correctly in the second |
| 250 // worker. | 250 // worker. |
| 251 checkWorkerCanExecuteScript(secondWorker.get()); | 251 checkWorkerCanExecuteScript(secondWorker.get()); |
| 252 secondWorker->terminateAndWait(); | 252 secondWorker->terminateAndWait(); |
| 253 } | 253 } |
| 254 | 254 |
| 255 } // namespace blink | 255 } // namespace blink |
| OLD | NEW |