| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 AnimationWorkletThread::clearSharedBackingThread(); | 95 AnimationWorkletThread::clearSharedBackingThread(); |
| 96 } | 96 } |
| 97 | 97 |
| 98 std::unique_ptr<AnimationWorkletThread> createAnimationWorkletThread() { | 98 std::unique_ptr<AnimationWorkletThread> createAnimationWorkletThread() { |
| 99 std::unique_ptr<AnimationWorkletThread> thread = | 99 std::unique_ptr<AnimationWorkletThread> thread = |
| 100 AnimationWorkletThread::create(nullptr, *m_reportingProxy); | 100 AnimationWorkletThread::create(nullptr, *m_reportingProxy); |
| 101 thread->start(WorkerThreadStartupData::create( | 101 thread->start(WorkerThreadStartupData::create( |
| 102 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", "", | 102 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", "", |
| 103 nullptr, DontPauseWorkerGlobalScopeOnStart, nullptr, "", | 103 nullptr, DontPauseWorkerGlobalScopeOnStart, nullptr, "", |
| 104 m_securityOrigin.get(), nullptr, WebAddressSpaceLocal, nullptr, nullptr, | 104 m_securityOrigin.get(), nullptr, WebAddressSpaceLocal, nullptr, nullptr, |
| 105 V8CacheOptionsDefault)); | 105 WorkerV8Settings::Default())); |
| 106 return thread; | 106 return thread; |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Attempts to run some simple script for |thread|. | 109 // Attempts to run some simple script for |thread|. |
| 110 void checkWorkletCanExecuteScript(WorkerThread* thread) { | 110 void checkWorkletCanExecuteScript(WorkerThread* thread) { |
| 111 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>(); | 111 std::unique_ptr<WaitableEvent> waitEvent = WTF::makeUnique<WaitableEvent>(); |
| 112 thread->workerBackingThread().backingThread().postTask( | 112 thread->workerBackingThread().backingThread().postTask( |
| 113 BLINK_FROM_HERE, | 113 BLINK_FROM_HERE, |
| 114 crossThreadBind(&AnimationWorkletThreadTest::executeScriptInWorklet, | 114 crossThreadBind(&AnimationWorkletThreadTest::executeScriptInWorklet, |
| 115 crossThreadUnretained(this), | 115 crossThreadUnretained(this), |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 ASSERT_TRUE(secondIsolate); | 227 ASSERT_TRUE(secondIsolate); |
| 228 EXPECT_EQ(firstIsolate, secondIsolate); | 228 EXPECT_EQ(firstIsolate, secondIsolate); |
| 229 | 229 |
| 230 // Verify that the isolate can run some scripts correctly in the second | 230 // Verify that the isolate can run some scripts correctly in the second |
| 231 // worklet. | 231 // worklet. |
| 232 checkWorkletCanExecuteScript(secondWorklet.get()); | 232 checkWorkletCanExecuteScript(secondWorklet.get()); |
| 233 secondWorklet->terminateAndWait(); | 233 secondWorklet->terminateAndWait(); |
| 234 } | 234 } |
| 235 | 235 |
| 236 } // namespace blink | 236 } // namespace blink |
| OLD | NEW |