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