| 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/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/WaitableEvent.h" |
| 17 #include "platform/heap/Handle.h" | 17 #include "platform/heap/Handle.h" |
| 18 #include "platform/testing/TestingPlatformSupport.h" | 18 #include "platform/testing/TestingPlatformSupport.h" |
| 19 #include "platform/testing/UnitTestHelpers.h" | 19 #include "platform/testing/UnitTestHelpers.h" |
| 20 #include "public/platform/Platform.h" | 20 #include "public/platform/Platform.h" |
| 21 #include "public/platform/WebAddressSpace.h" |
| 21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
| 22 | 23 |
| 23 namespace blink { | 24 namespace blink { |
| 24 namespace { | 25 namespace { |
| 25 | 26 |
| 26 class TestCompositorWorkerThread : public CompositorWorkerThread { | 27 class TestCompositorWorkerThread : public CompositorWorkerThread { |
| 27 public: | 28 public: |
| 28 TestCompositorWorkerThread(WorkerLoaderProxyProvider* loaderProxyProvider, W
orkerObjectProxy& objectProxy, double timeOrigin, WaitableEvent* startEvent) | 29 TestCompositorWorkerThread(WorkerLoaderProxyProvider* loaderProxyProvider, W
orkerObjectProxy& objectProxy, double timeOrigin, WaitableEvent* startEvent) |
| 29 : CompositorWorkerThread(WorkerLoaderProxy::create(loaderProxyProvider),
objectProxy, timeOrigin) | 30 : CompositorWorkerThread(WorkerLoaderProxy::create(loaderProxyProvider),
objectProxy, timeOrigin) |
| 30 , m_startEvent(startEvent) | 31 , m_startEvent(startEvent) |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 OwnPtrWillBeRawPtr<WorkerClients> clients = nullptr; | 141 OwnPtrWillBeRawPtr<WorkerClients> clients = nullptr; |
| 141 workerThread->start(WorkerThreadStartupData::create( | 142 workerThread->start(WorkerThreadStartupData::create( |
| 142 KURL(ParsedURLString, "http://fake.url/"), | 143 KURL(ParsedURLString, "http://fake.url/"), |
| 143 "fake user agent", | 144 "fake user agent", |
| 144 "//fake source code", | 145 "//fake source code", |
| 145 nullptr, | 146 nullptr, |
| 146 DontPauseWorkerGlobalScopeOnStart, | 147 DontPauseWorkerGlobalScopeOnStart, |
| 147 adoptPtr(new Vector<CSPHeaderAndType>()), | 148 adoptPtr(new Vector<CSPHeaderAndType>()), |
| 148 m_securityOrigin.get(), | 149 m_securityOrigin.get(), |
| 149 clients.release(), | 150 clients.release(), |
| 150 WebURLRequest::AddressSpaceLocal, | 151 WebAddressSpaceLocal, |
| 151 V8CacheOptionsDefault)); | 152 V8CacheOptionsDefault)); |
| 152 return adoptPtr(workerThread); | 153 return adoptPtr(workerThread); |
| 153 } | 154 } |
| 154 | 155 |
| 155 void createWorkerAdapter(OwnPtr<CompositorWorkerThread>* workerThread, Waita
bleEvent* creationEvent) | 156 void createWorkerAdapter(OwnPtr<CompositorWorkerThread>* workerThread, Waita
bleEvent* creationEvent) |
| 156 { | 157 { |
| 157 *workerThread = createCompositorWorker(creationEvent); | 158 *workerThread = createCompositorWorker(creationEvent); |
| 158 } | 159 } |
| 159 | 160 |
| 160 // Attempts to run some simple script for |worker|. | 161 // Attempts to run some simple script for |worker|. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 v8::Isolate* secondIsolate = secondWorker->isolate(); | 296 v8::Isolate* secondIsolate = secondWorker->isolate(); |
| 296 ASSERT(secondIsolate); | 297 ASSERT(secondIsolate); |
| 297 EXPECT_EQ(firstIsolate, secondIsolate); | 298 EXPECT_EQ(firstIsolate, secondIsolate); |
| 298 | 299 |
| 299 // Verify that the isolate can run some scripts correctly in the second work
er. | 300 // Verify that the isolate can run some scripts correctly in the second work
er. |
| 300 checkWorkerCanExecuteScript(secondWorker.get()); | 301 checkWorkerCanExecuteScript(secondWorker.get()); |
| 301 secondWorker->terminateAndWait(); | 302 secondWorker->terminateAndWait(); |
| 302 } | 303 } |
| 303 | 304 |
| 304 } // namespace blink | 305 } // namespace blink |
| OLD | NEW |