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

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

Issue 2716853002: (WIP) Worker: Merge ParentFrameTaskRunners into TaskRunnerHelper
Patch Set: WIP Created 3 years, 9 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/AnimationWorkletThread.h" 5 #include "modules/compositorworker/AnimationWorkletThread.h"
6 6
7 #include <memory>
7 #include "bindings/core/v8/ScriptSourceCode.h" 8 #include "bindings/core/v8/ScriptSourceCode.h"
8 #include "bindings/core/v8/SourceLocation.h" 9 #include "bindings/core/v8/SourceLocation.h"
9 #include "bindings/core/v8/V8GCController.h" 10 #include "bindings/core/v8/V8GCController.h"
10 #include "bindings/core/v8/WorkerOrWorkletScriptController.h" 11 #include "bindings/core/v8/WorkerOrWorkletScriptController.h"
12 #include "core/dom/TaskRunnerHelper.h"
11 #include "core/inspector/ConsoleMessage.h" 13 #include "core/inspector/ConsoleMessage.h"
12 #include "core/workers/InProcessWorkerObjectProxy.h" 14 #include "core/workers/InProcessWorkerObjectProxy.h"
13 #include "core/workers/ParentFrameTaskRunners.h"
14 #include "core/workers/WorkerBackingThread.h" 15 #include "core/workers/WorkerBackingThread.h"
15 #include "core/workers/WorkerLoaderProxy.h" 16 #include "core/workers/WorkerLoaderProxy.h"
16 #include "core/workers/WorkerOrWorkletGlobalScope.h" 17 #include "core/workers/WorkerOrWorkletGlobalScope.h"
17 #include "core/workers/WorkerThreadStartupData.h" 18 #include "core/workers/WorkerThreadStartupData.h"
18 #include "platform/CrossThreadFunctional.h" 19 #include "platform/CrossThreadFunctional.h"
19 #include "platform/WaitableEvent.h" 20 #include "platform/WaitableEvent.h"
20 #include "platform/WebThreadSupportingGC.h" 21 #include "platform/WebThreadSupportingGC.h"
21 #include "platform/heap/Handle.h" 22 #include "platform/heap/Handle.h"
22 #include "platform/testing/TestingPlatformSupport.h" 23 #include "platform/testing/TestingPlatformSupport.h"
23 #include "platform/testing/UnitTestHelpers.h" 24 #include "platform/testing/UnitTestHelpers.h"
24 #include "public/platform/Platform.h" 25 #include "public/platform/Platform.h"
25 #include "public/platform/WebAddressSpace.h" 26 #include "public/platform/WebAddressSpace.h"
26 #include "testing/gtest/include/gtest/gtest.h" 27 #include "testing/gtest/include/gtest/gtest.h"
27 #include "wtf/PtrUtil.h" 28 #include "wtf/PtrUtil.h"
28 #include <memory>
29 29
30 namespace blink { 30 namespace blink {
31 namespace { 31 namespace {
32 32
33 // A null WorkerReportingProxy, supplied when creating AnimationWorkletThreads. 33 // A null WorkerReportingProxy, supplied when creating AnimationWorkletThreads.
34 class TestAnimationWorkletReportingProxy : public WorkerReportingProxy { 34 class TestAnimationWorkletReportingProxy : public WorkerReportingProxy {
35 public: 35 public:
36 static std::unique_ptr<TestAnimationWorkletReportingProxy> create() { 36 static std::unique_ptr<TestAnimationWorkletReportingProxy> create() {
37 return WTF::wrapUnique(new TestAnimationWorkletReportingProxy()); 37 return WTF::wrapUnique(new TestAnimationWorkletReportingProxy());
38 } 38 }
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 std::unique_ptr<AnimationWorkletThread> createAnimationWorkletThread() { 91 std::unique_ptr<AnimationWorkletThread> createAnimationWorkletThread() {
92 std::unique_ptr<AnimationWorkletThread> thread = 92 std::unique_ptr<AnimationWorkletThread> thread =
93 AnimationWorkletThread::create(nullptr, *m_reportingProxy); 93 AnimationWorkletThread::create(nullptr, *m_reportingProxy);
94 thread->start( 94 thread->start(
95 WorkerThreadStartupData::create( 95 WorkerThreadStartupData::create(
96 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", "", 96 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", "",
97 nullptr, DontPauseWorkerGlobalScopeOnStart, nullptr, "", 97 nullptr, DontPauseWorkerGlobalScopeOnStart, nullptr, "",
98 m_securityOrigin.get(), nullptr, WebAddressSpaceLocal, nullptr, 98 m_securityOrigin.get(), nullptr, WebAddressSpaceLocal, nullptr,
99 nullptr, WorkerV8Settings::Default()), 99 nullptr, WorkerV8Settings::Default()),
100 ParentFrameTaskRunners::create(nullptr)); 100 FrameTaskRunnersHolder::create(nullptr));
101 return thread; 101 return thread;
102 } 102 }
103 103
104 // Attempts to run some simple script for |thread|. 104 // Attempts to run some simple script for |thread|.
105 void checkWorkletCanExecuteScript(WorkerThread* thread) { 105 void checkWorkletCanExecuteScript(WorkerThread* thread) {
106 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>(); 106 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>();
107 thread->workerBackingThread().backingThread().postTask( 107 thread->workerBackingThread().backingThread().postTask(
108 BLINK_FROM_HERE, 108 BLINK_FROM_HERE,
109 crossThreadBind(&AnimationWorkletThreadTest::executeScriptInWorklet, 109 crossThreadBind(&AnimationWorkletThreadTest::executeScriptInWorklet,
110 crossThreadUnretained(this), 110 crossThreadUnretained(this),
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 ASSERT_TRUE(secondIsolate); 217 ASSERT_TRUE(secondIsolate);
218 EXPECT_EQ(firstIsolate, secondIsolate); 218 EXPECT_EQ(firstIsolate, secondIsolate);
219 219
220 // Verify that the isolate can run some scripts correctly in the second 220 // Verify that the isolate can run some scripts correctly in the second
221 // worklet. 221 // worklet.
222 checkWorkletCanExecuteScript(secondWorklet.get()); 222 checkWorkletCanExecuteScript(secondWorklet.get());
223 secondWorklet->terminateAndWait(); 223 secondWorklet->terminateAndWait();
224 } 224 }
225 225
226 } // namespace blink 226 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698