| 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, WorkerV8Settings::Default(), | 118 nullptr, nullptr, WorkerV8Settings::Default())); |
| 119 false /* inspectorNetworkCapability */)); | |
| 120 return workerThread; | 119 return workerThread; |
| 121 } | 120 } |
| 122 | 121 |
| 123 // Attempts to run some simple script for |worker|. | 122 // Attempts to run some simple script for |worker|. |
| 124 void checkWorkerCanExecuteScript(WorkerThread* worker) { | 123 void checkWorkerCanExecuteScript(WorkerThread* worker) { |
| 125 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>(); | 124 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>(); |
| 126 worker->workerBackingThread().backingThread().postTask( | 125 worker->workerBackingThread().backingThread().postTask( |
| 127 BLINK_FROM_HERE, | 126 BLINK_FROM_HERE, |
| 128 crossThreadBind(&CompositorWorkerThreadTest::executeScriptInWorker, | 127 crossThreadBind(&CompositorWorkerThreadTest::executeScriptInWorker, |
| 129 crossThreadUnretained(this), | 128 crossThreadUnretained(this), |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 ASSERT_TRUE(secondIsolate); | 235 ASSERT_TRUE(secondIsolate); |
| 237 EXPECT_EQ(firstIsolate, secondIsolate); | 236 EXPECT_EQ(firstIsolate, secondIsolate); |
| 238 | 237 |
| 239 // Verify that the isolate can run some scripts correctly in the second | 238 // Verify that the isolate can run some scripts correctly in the second |
| 240 // worker. | 239 // worker. |
| 241 checkWorkerCanExecuteScript(secondWorker.get()); | 240 checkWorkerCanExecuteScript(secondWorker.get()); |
| 242 secondWorker->terminateAndWait(); | 241 secondWorker->terminateAndWait(); |
| 243 } | 242 } |
| 244 | 243 |
| 245 } // namespace blink | 244 } // namespace blink |
| OLD | NEW |