Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: third_party/WebKit/Source/modules/compositorworker/CompositorWorkerThreadTest.cpp

Issue 2515363002: Introduce AnimationWorkletProxyClient and necessary plumbing to get it in worklet messaging proxy. (Closed)
Patch Set: address feedback Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "core/dom/CompositorProxyClient.h" 11 #include "core/dom/CompositorWorkerProxyClient.h"
12 #include "core/inspector/ConsoleMessage.h" 12 #include "core/inspector/ConsoleMessage.h"
13 #include "core/testing/DummyPageHolder.h" 13 #include "core/testing/DummyPageHolder.h"
14 #include "core/workers/InProcessWorkerObjectProxy.h" 14 #include "core/workers/InProcessWorkerObjectProxy.h"
15 #include "core/workers/WorkerBackingThread.h" 15 #include "core/workers/WorkerBackingThread.h"
16 #include "core/workers/WorkerLoaderProxy.h" 16 #include "core/workers/WorkerLoaderProxy.h"
17 #include "core/workers/WorkerOrWorkletGlobalScope.h" 17 #include "core/workers/WorkerOrWorkletGlobalScope.h"
18 #include "core/workers/WorkerThreadStartupData.h" 18 #include "core/workers/WorkerThreadStartupData.h"
19 #include "platform/CrossThreadFunctional.h" 19 #include "platform/CrossThreadFunctional.h"
20 #include "platform/WaitableEvent.h" 20 #include "platform/WaitableEvent.h"
21 #include "platform/WebThreadSupportingGC.h" 21 #include "platform/WebThreadSupportingGC.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 return m_executionContext.get(); 60 return m_executionContext.get();
61 } 61 }
62 62
63 private: 63 private:
64 TestCompositorWorkerObjectProxy(ExecutionContext* context) 64 TestCompositorWorkerObjectProxy(ExecutionContext* context)
65 : InProcessWorkerObjectProxy(nullptr), m_executionContext(context) {} 65 : InProcessWorkerObjectProxy(nullptr), m_executionContext(context) {}
66 66
67 Persistent<ExecutionContext> m_executionContext; 67 Persistent<ExecutionContext> m_executionContext;
68 }; 68 };
69 69
70 class TestCompositorProxyClient 70 class TestCompositorWorkerProxyClient
71 : public GarbageCollected<TestCompositorProxyClient>, 71 : public GarbageCollected<TestCompositorWorkerProxyClient>,
72 public CompositorProxyClient { 72 public CompositorWorkerProxyClient {
73 USING_GARBAGE_COLLECTED_MIXIN(TestCompositorProxyClient); 73 USING_GARBAGE_COLLECTED_MIXIN(TestCompositorWorkerProxyClient);
74 74
75 public: 75 public:
76 TestCompositorProxyClient() {} 76 TestCompositorWorkerProxyClient() {}
77 77
78 void dispose() override {} 78 void dispose() override {}
79 void setGlobalScope(WorkerGlobalScope*) override {} 79 void setGlobalScope(WorkerGlobalScope*) override {}
80 void requestAnimationFrame() override {} 80 void requestAnimationFrame() override {}
81 void registerCompositorProxy(CompositorProxy*) override {} 81 void registerCompositorProxy(CompositorProxy*) override {}
82 void unregisterCompositorProxy(CompositorProxy*) override {} 82 void unregisterCompositorProxy(CompositorProxy*) override {}
83 }; 83 };
84 84
85 class CompositorWorkerTestPlatform : public TestingPlatformSupport { 85 class CompositorWorkerTestPlatform : public TestingPlatformSupport {
86 public: 86 public:
(...skipping 26 matching lines...) Expand all
113 113
114 void TearDown() override { 114 void TearDown() override {
115 m_page.reset(); 115 m_page.reset();
116 CompositorWorkerThread::clearSharedBackingThread(); 116 CompositorWorkerThread::clearSharedBackingThread();
117 } 117 }
118 118
119 std::unique_ptr<CompositorWorkerThread> createCompositorWorker() { 119 std::unique_ptr<CompositorWorkerThread> createCompositorWorker() {
120 std::unique_ptr<CompositorWorkerThread> workerThread = 120 std::unique_ptr<CompositorWorkerThread> workerThread =
121 CompositorWorkerThread::create(nullptr, *m_objectProxy, 0); 121 CompositorWorkerThread::create(nullptr, *m_objectProxy, 0);
122 WorkerClients* clients = WorkerClients::create(); 122 WorkerClients* clients = WorkerClients::create();
123 provideCompositorProxyClientTo(clients, new TestCompositorProxyClient); 123 provideCompositorWorkerProxyClientTo(clients,
124 new TestCompositorWorkerProxyClient);
124 workerThread->start(WorkerThreadStartupData::create( 125 workerThread->start(WorkerThreadStartupData::create(
125 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", 126 KURL(ParsedURLString, "http://fake.url/"), "fake user agent",
126 "//fake source code", nullptr, DontPauseWorkerGlobalScopeOnStart, 127 "//fake source code", nullptr, DontPauseWorkerGlobalScopeOnStart,
127 nullptr, "", m_securityOrigin.get(), clients, WebAddressSpaceLocal, 128 nullptr, "", m_securityOrigin.get(), clients, WebAddressSpaceLocal,
128 nullptr, nullptr, V8CacheOptionsDefault)); 129 nullptr, nullptr, V8CacheOptionsDefault));
129 return workerThread; 130 return workerThread;
130 } 131 }
131 132
132 // Attempts to run some simple script for |worker|. 133 // Attempts to run some simple script for |worker|.
133 void checkWorkerCanExecuteScript(WorkerThread* worker) { 134 void checkWorkerCanExecuteScript(WorkerThread* worker) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 ASSERT_TRUE(secondIsolate); 247 ASSERT_TRUE(secondIsolate);
247 EXPECT_EQ(firstIsolate, secondIsolate); 248 EXPECT_EQ(firstIsolate, secondIsolate);
248 249
249 // Verify that the isolate can run some scripts correctly in the second 250 // Verify that the isolate can run some scripts correctly in the second
250 // worker. 251 // worker.
251 checkWorkerCanExecuteScript(secondWorker.get()); 252 checkWorkerCanExecuteScript(secondWorker.get());
252 secondWorker->terminateAndWait(); 253 secondWorker->terminateAndWait();
253 } 254 }
254 255
255 } // namespace blink 256 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698