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

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: Remove unnecessary PLATFORM_EXPORT Created 3 years, 10 months 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/workers/InProcessWorkerObjectProxy.h" 13 #include "core/workers/InProcessWorkerObjectProxy.h"
14 #include "core/workers/ParentFrameTaskRunners.h" 14 #include "core/workers/ParentFrameTaskRunners.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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 void didCloseWorkerGlobalScope() override {} 55 void didCloseWorkerGlobalScope() override {}
56 void willDestroyWorkerGlobalScope() override {} 56 void willDestroyWorkerGlobalScope() override {}
57 void didTerminateWorkerThread() override {} 57 void didTerminateWorkerThread() override {}
58 58
59 private: 59 private:
60 explicit TestCompositorWorkerObjectProxy( 60 explicit TestCompositorWorkerObjectProxy(
61 ParentFrameTaskRunners* parentFrameTaskRunners) 61 ParentFrameTaskRunners* parentFrameTaskRunners)
62 : InProcessWorkerObjectProxy(nullptr, parentFrameTaskRunners) {} 62 : InProcessWorkerObjectProxy(nullptr, parentFrameTaskRunners) {}
63 }; 63 };
64 64
65 class TestCompositorProxyClient 65 class TestCompositorWorkerProxyClient : public CompositorWorkerProxyClient {
66 : public GarbageCollected<TestCompositorProxyClient>,
67 public CompositorProxyClient {
68 USING_GARBAGE_COLLECTED_MIXIN(TestCompositorProxyClient);
69
70 public: 66 public:
71 TestCompositorProxyClient() {} 67 TestCompositorWorkerProxyClient() {}
72 68
73 void dispose() override {} 69 void dispose() override {}
74 void setGlobalScope(WorkerGlobalScope*) override {} 70 void setGlobalScope(WorkerGlobalScope*) override {}
75 void requestAnimationFrame() override {} 71 void requestAnimationFrame() override {}
76 void registerCompositorProxy(CompositorProxy*) override {} 72 void registerCompositorProxy(CompositorProxy*) override {}
77 void unregisterCompositorProxy(CompositorProxy*) override {} 73 void unregisterCompositorProxy(CompositorProxy*) override {}
78 }; 74 };
79 75
80 class CompositorWorkerTestPlatform : public TestingPlatformSupport { 76 class CompositorWorkerTestPlatform : public TestingPlatformSupport {
81 public: 77 public:
(...skipping 26 matching lines...) Expand all
108 104
109 void TearDown() override { 105 void TearDown() override {
110 CompositorWorkerThread::clearSharedBackingThread(); 106 CompositorWorkerThread::clearSharedBackingThread();
111 } 107 }
112 108
113 std::unique_ptr<CompositorWorkerThread> createCompositorWorker() { 109 std::unique_ptr<CompositorWorkerThread> createCompositorWorker() {
114 std::unique_ptr<CompositorWorkerThread> workerThread = 110 std::unique_ptr<CompositorWorkerThread> workerThread =
115 CompositorWorkerThread::create(nullptr, *m_objectProxy, 111 CompositorWorkerThread::create(nullptr, *m_objectProxy,
116 m_parentFrameTaskRunners.get(), 0); 112 m_parentFrameTaskRunners.get(), 0);
117 WorkerClients* clients = WorkerClients::create(); 113 WorkerClients* clients = WorkerClients::create();
118 provideCompositorProxyClientTo(clients, new TestCompositorProxyClient); 114 provideCompositorWorkerProxyClientTo(clients,
115 new TestCompositorWorkerProxyClient);
119 workerThread->start(WorkerThreadStartupData::create( 116 workerThread->start(WorkerThreadStartupData::create(
120 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", 117 KURL(ParsedURLString, "http://fake.url/"), "fake user agent",
121 "//fake source code", nullptr, DontPauseWorkerGlobalScopeOnStart, 118 "//fake source code", nullptr, DontPauseWorkerGlobalScopeOnStart,
122 nullptr, "", m_securityOrigin.get(), clients, WebAddressSpaceLocal, 119 nullptr, "", m_securityOrigin.get(), clients, WebAddressSpaceLocal,
123 nullptr, nullptr, WorkerV8Settings::Default())); 120 nullptr, nullptr, WorkerV8Settings::Default()));
124 return workerThread; 121 return workerThread;
125 } 122 }
126 123
127 // Attempts to run some simple script for |worker|. 124 // Attempts to run some simple script for |worker|.
128 void checkWorkerCanExecuteScript(WorkerThread* worker) { 125 void checkWorkerCanExecuteScript(WorkerThread* worker) {
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 ASSERT_TRUE(secondIsolate); 238 ASSERT_TRUE(secondIsolate);
242 EXPECT_EQ(firstIsolate, secondIsolate); 239 EXPECT_EQ(firstIsolate, secondIsolate);
243 240
244 // Verify that the isolate can run some scripts correctly in the second 241 // Verify that the isolate can run some scripts correctly in the second
245 // worker. 242 // worker.
246 checkWorkerCanExecuteScript(secondWorker.get()); 243 checkWorkerCanExecuteScript(secondWorker.get());
247 secondWorker->terminateAndWait(); 244 secondWorker->terminateAndWait();
248 } 245 }
249 246
250 } // namespace blink 247 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698