| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 | 108 |
| 109 std::unique_ptr<CompositorWorkerThread> createCompositorWorker() { | 109 std::unique_ptr<CompositorWorkerThread> createCompositorWorker() { |
| 110 std::unique_ptr<CompositorWorkerThread> workerThread = | 110 std::unique_ptr<CompositorWorkerThread> workerThread = |
| 111 CompositorWorkerThread::create(nullptr, *m_objectProxy, 0); | 111 CompositorWorkerThread::create(nullptr, *m_objectProxy, 0); |
| 112 WorkerClients* clients = WorkerClients::create(); | 112 WorkerClients* clients = WorkerClients::create(); |
| 113 provideCompositorProxyClientTo(clients, new TestCompositorProxyClient); | 113 provideCompositorProxyClientTo(clients, new TestCompositorProxyClient); |
| 114 workerThread->start(WorkerThreadStartupData::create( | 114 workerThread->start(WorkerThreadStartupData::create( |
| 115 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", | 115 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", |
| 116 "//fake source code", nullptr, DontPauseWorkerGlobalScopeOnStart, | 116 "//fake source code", nullptr, DontPauseWorkerGlobalScopeOnStart, |
| 117 nullptr, "", m_securityOrigin.get(), clients, WebAddressSpaceLocal, | 117 nullptr, "", m_securityOrigin.get(), clients, WebAddressSpaceLocal, |
| 118 nullptr, nullptr, V8CacheOptionsDefault)); | 118 nullptr, nullptr, WorkerV8Settings::Default())); |
| 119 return workerThread; | 119 return workerThread; |
| 120 } | 120 } |
| 121 | 121 |
| 122 // Attempts to run some simple script for |worker|. | 122 // Attempts to run some simple script for |worker|. |
| 123 void checkWorkerCanExecuteScript(WorkerThread* worker) { | 123 void checkWorkerCanExecuteScript(WorkerThread* worker) { |
| 124 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>(); | 124 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>(); |
| 125 worker->workerBackingThread().backingThread().postTask( | 125 worker->workerBackingThread().backingThread().postTask( |
| 126 BLINK_FROM_HERE, | 126 BLINK_FROM_HERE, |
| 127 crossThreadBind(&CompositorWorkerThreadTest::executeScriptInWorker, | 127 crossThreadBind(&CompositorWorkerThreadTest::executeScriptInWorker, |
| 128 crossThreadUnretained(this), | 128 crossThreadUnretained(this), |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 ASSERT_TRUE(secondIsolate); | 242 ASSERT_TRUE(secondIsolate); |
| 243 EXPECT_EQ(firstIsolate, secondIsolate); | 243 EXPECT_EQ(firstIsolate, secondIsolate); |
| 244 | 244 |
| 245 // Verify that the isolate can run some scripts correctly in the second | 245 // Verify that the isolate can run some scripts correctly in the second |
| 246 // worker. | 246 // worker. |
| 247 checkWorkerCanExecuteScript(secondWorker.get()); | 247 checkWorkerCanExecuteScript(secondWorker.get()); |
| 248 secondWorker->terminateAndWait(); | 248 secondWorker->terminateAndWait(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace blink | 251 } // namespace blink |
| OLD | NEW |