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