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/AnimationWorkletThread.h" | 5 #include "modules/compositorworker/AnimationWorkletThread.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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 m_securityOrigin = | 83 m_securityOrigin = |
84 SecurityOrigin::create(KURL(ParsedURLString, "http://fake.url/")); | 84 SecurityOrigin::create(KURL(ParsedURLString, "http://fake.url/")); |
85 } | 85 } |
86 | 86 |
87 void TearDown() override { | 87 void TearDown() override { |
88 AnimationWorkletThread::clearSharedBackingThread(); | 88 AnimationWorkletThread::clearSharedBackingThread(); |
89 } | 89 } |
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 ParentFrameTaskRunners::create(nullptr)); | 94 thread->start( |
95 thread->start(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, nullptr, | 98 m_securityOrigin.get(), nullptr, WebAddressSpaceLocal, nullptr, |
99 WorkerV8Settings::Default())); | 99 nullptr, WorkerV8Settings::Default()), |
| 100 ParentFrameTaskRunners::create(nullptr)); |
100 return thread; | 101 return thread; |
101 } | 102 } |
102 | 103 |
103 // Attempts to run some simple script for |thread|. | 104 // Attempts to run some simple script for |thread|. |
104 void checkWorkletCanExecuteScript(WorkerThread* thread) { | 105 void checkWorkletCanExecuteScript(WorkerThread* thread) { |
105 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>(); | 106 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>(); |
106 thread->workerBackingThread().backingThread().postTask( | 107 thread->workerBackingThread().backingThread().postTask( |
107 BLINK_FROM_HERE, | 108 BLINK_FROM_HERE, |
108 crossThreadBind(&AnimationWorkletThreadTest::executeScriptInWorklet, | 109 crossThreadBind(&AnimationWorkletThreadTest::executeScriptInWorklet, |
109 crossThreadUnretained(this), | 110 crossThreadUnretained(this), |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 ASSERT_TRUE(secondIsolate); | 217 ASSERT_TRUE(secondIsolate); |
217 EXPECT_EQ(firstIsolate, secondIsolate); | 218 EXPECT_EQ(firstIsolate, secondIsolate); |
218 | 219 |
219 // 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 |
220 // worklet. | 221 // worklet. |
221 checkWorkletCanExecuteScript(secondWorklet.get()); | 222 checkWorkletCanExecuteScript(secondWorklet.get()); |
222 secondWorklet->terminateAndWait(); | 223 secondWorklet->terminateAndWait(); |
223 } | 224 } |
224 | 225 |
225 } // namespace blink | 226 } // namespace blink |
OLD | NEW |