| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 } | 60 } |
| 61 | 61 |
| 62 Persistent<ExecutionContext> m_executionContext; | 62 Persistent<ExecutionContext> m_executionContext; |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 class TestCompositorProxyClient | 65 class TestCompositorProxyClient |
| 66 : public GarbageCollected<TestCompositorProxyClient> | 66 : public GarbageCollected<TestCompositorProxyClient> |
| 67 , public CompositorProxyClient { | 67 , public CompositorProxyClient { |
| 68 USING_GARBAGE_COLLECTED_MIXIN(TestCompositorProxyClient); | 68 USING_GARBAGE_COLLECTED_MIXIN(TestCompositorProxyClient); |
| 69 public: | 69 public: |
| 70 TestCompositorProxyClient() {} | 70 explicit TestCompositorProxyClient(WorkerClients& clients) |
| 71 : CompositorProxyClient(clients) |
| 72 { |
| 73 } |
| 71 | 74 |
| 72 void setGlobalScope(WorkerGlobalScope*) override {} | 75 void setGlobalScope(WorkerGlobalScope*) override {} |
| 73 void requestAnimationFrame() override {} | 76 void requestAnimationFrame() override {} |
| 74 void registerCompositorProxy(CompositorProxy*) override {} | 77 void registerCompositorProxy(CompositorProxy*) override {} |
| 75 void unregisterCompositorProxy(CompositorProxy*) override {} | 78 void unregisterCompositorProxy(CompositorProxy*) override {} |
| 76 }; | 79 }; |
| 77 | 80 |
| 78 class CompositorWorkerTestPlatform : public TestingPlatformSupport { | 81 class CompositorWorkerTestPlatform : public TestingPlatformSupport { |
| 79 public: | 82 public: |
| 80 CompositorWorkerTestPlatform() | 83 CompositorWorkerTestPlatform() |
| (...skipping 28 matching lines...) Expand all Loading... |
| 109 void TearDown() override | 112 void TearDown() override |
| 110 { | 113 { |
| 111 m_page.reset(); | 114 m_page.reset(); |
| 112 CompositorWorkerThread::clearSharedBackingThread(); | 115 CompositorWorkerThread::clearSharedBackingThread(); |
| 113 } | 116 } |
| 114 | 117 |
| 115 std::unique_ptr<CompositorWorkerThread> createCompositorWorker() | 118 std::unique_ptr<CompositorWorkerThread> createCompositorWorker() |
| 116 { | 119 { |
| 117 std::unique_ptr<CompositorWorkerThread> workerThread = CompositorWorkerT
hread::create(nullptr, *m_objectProxy, 0); | 120 std::unique_ptr<CompositorWorkerThread> workerThread = CompositorWorkerT
hread::create(nullptr, *m_objectProxy, 0); |
| 118 WorkerClients* clients = WorkerClients::create(); | 121 WorkerClients* clients = WorkerClients::create(); |
| 119 provideCompositorProxyClientTo(clients, new TestCompositorProxyClient); | 122 provideCompositorProxyClientTo(clients, new TestCompositorProxyClient(*c
lients)); |
| 120 workerThread->start(WorkerThreadStartupData::create( | 123 workerThread->start(WorkerThreadStartupData::create( |
| 121 KURL(ParsedURLString, "http://fake.url/"), | 124 KURL(ParsedURLString, "http://fake.url/"), |
| 122 "fake user agent", | 125 "fake user agent", |
| 123 "//fake source code", | 126 "//fake source code", |
| 124 nullptr, | 127 nullptr, |
| 125 DontPauseWorkerGlobalScopeOnStart, | 128 DontPauseWorkerGlobalScopeOnStart, |
| 126 nullptr, | 129 nullptr, |
| 127 "", | 130 "", |
| 128 m_securityOrigin.get(), | 131 m_securityOrigin.get(), |
| 129 clients, | 132 clients, |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 v8::Isolate* secondIsolate = secondWorker->isolate(); | 240 v8::Isolate* secondIsolate = secondWorker->isolate(); |
| 238 ASSERT_TRUE(secondIsolate); | 241 ASSERT_TRUE(secondIsolate); |
| 239 EXPECT_EQ(firstIsolate, secondIsolate); | 242 EXPECT_EQ(firstIsolate, secondIsolate); |
| 240 | 243 |
| 241 // Verify that the isolate can run some scripts correctly in the second work
er. | 244 // Verify that the isolate can run some scripts correctly in the second work
er. |
| 242 checkWorkerCanExecuteScript(secondWorker.get()); | 245 checkWorkerCanExecuteScript(secondWorker.get()); |
| 243 secondWorker->terminateAndWait(); | 246 secondWorker->terminateAndWait(); |
| 244 } | 247 } |
| 245 | 248 |
| 246 } // namespace blink | 249 } // namespace blink |
| OLD | NEW |