| 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 30 matching lines...) Expand all Loading... |
| 41 void countFeature(UseCounter::Feature) override {} | 41 void countFeature(UseCounter::Feature) override {} |
| 42 void countDeprecation(UseCounter::Feature) override {} | 42 void countDeprecation(UseCounter::Feature) override {} |
| 43 void reportException(const String& errorMessage, | 43 void reportException(const String& errorMessage, |
| 44 std::unique_ptr<SourceLocation>, | 44 std::unique_ptr<SourceLocation>, |
| 45 int exceptionId) override {} | 45 int exceptionId) override {} |
| 46 void reportConsoleMessage(MessageSource, | 46 void reportConsoleMessage(MessageSource, |
| 47 MessageLevel, | 47 MessageLevel, |
| 48 const String& message, | 48 const String& message, |
| 49 SourceLocation*) override {} | 49 SourceLocation*) override {} |
| 50 void postMessageToPageInspector(const String&) override {} | 50 void postMessageToPageInspector(const String&) override {} |
| 51 ParentFrameTaskRunners* getParentFrameTaskRunners() override { | |
| 52 return m_parentFrameTaskRunners.get(); | |
| 53 } | |
| 54 | |
| 55 void didEvaluateWorkerScript(bool success) override {} | 51 void didEvaluateWorkerScript(bool success) override {} |
| 56 void didCloseWorkerGlobalScope() override {} | 52 void didCloseWorkerGlobalScope() override {} |
| 57 void willDestroyWorkerGlobalScope() override {} | 53 void willDestroyWorkerGlobalScope() override {} |
| 58 void didTerminateWorkerThread() override {} | 54 void didTerminateWorkerThread() override {} |
| 59 | 55 |
| 60 private: | 56 private: |
| 61 TestAnimationWorkletReportingProxy() | 57 TestAnimationWorkletReportingProxy() {} |
| 62 : m_parentFrameTaskRunners(ParentFrameTaskRunners::create(nullptr)) {} | |
| 63 | |
| 64 Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners; | |
| 65 }; | 58 }; |
| 66 | 59 |
| 67 class AnimationWorkletTestPlatform : public TestingPlatformSupport { | 60 class AnimationWorkletTestPlatform : public TestingPlatformSupport { |
| 68 public: | 61 public: |
| 69 AnimationWorkletTestPlatform() | 62 AnimationWorkletTestPlatform() |
| 70 : m_thread(WTF::wrapUnique(m_oldPlatform->createThread("Compositor"))) {} | 63 : m_thread(WTF::wrapUnique(m_oldPlatform->createThread("Compositor"))) {} |
| 71 | 64 |
| 72 WebThread* compositorThread() const override { return m_thread.get(); } | 65 WebThread* compositorThread() const override { return m_thread.get(); } |
| 73 | 66 |
| 74 WebCompositorSupport* compositorSupport() override { | 67 WebCompositorSupport* compositorSupport() override { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 90 m_securityOrigin = | 83 m_securityOrigin = |
| 91 SecurityOrigin::create(KURL(ParsedURLString, "http://fake.url/")); | 84 SecurityOrigin::create(KURL(ParsedURLString, "http://fake.url/")); |
| 92 } | 85 } |
| 93 | 86 |
| 94 void TearDown() override { | 87 void TearDown() override { |
| 95 AnimationWorkletThread::clearSharedBackingThread(); | 88 AnimationWorkletThread::clearSharedBackingThread(); |
| 96 } | 89 } |
| 97 | 90 |
| 98 std::unique_ptr<AnimationWorkletThread> createAnimationWorkletThread() { | 91 std::unique_ptr<AnimationWorkletThread> createAnimationWorkletThread() { |
| 99 std::unique_ptr<AnimationWorkletThread> thread = | 92 std::unique_ptr<AnimationWorkletThread> thread = |
| 100 AnimationWorkletThread::create(nullptr, *m_reportingProxy); | 93 AnimationWorkletThread::create(nullptr, *m_reportingProxy, |
| 94 ParentFrameTaskRunners::create(nullptr)); |
| 101 thread->start(WorkerThreadStartupData::create( | 95 thread->start(WorkerThreadStartupData::create( |
| 102 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", "", | 96 KURL(ParsedURLString, "http://fake.url/"), "fake user agent", "", |
| 103 nullptr, DontPauseWorkerGlobalScopeOnStart, nullptr, "", | 97 nullptr, DontPauseWorkerGlobalScopeOnStart, nullptr, "", |
| 104 m_securityOrigin.get(), nullptr, WebAddressSpaceLocal, nullptr, nullptr, | 98 m_securityOrigin.get(), nullptr, WebAddressSpaceLocal, nullptr, nullptr, |
| 105 WorkerV8Settings::Default(), false /* inspectorNetworkCapability */)); | 99 WorkerV8Settings::Default(), false /* inspectorNetworkCapability */)); |
| 106 return thread; | 100 return thread; |
| 107 } | 101 } |
| 108 | 102 |
| 109 // Attempts to run some simple script for |thread|. | 103 // Attempts to run some simple script for |thread|. |
| 110 void checkWorkletCanExecuteScript(WorkerThread* thread) { | 104 void checkWorkletCanExecuteScript(WorkerThread* thread) { |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 ASSERT_TRUE(secondIsolate); | 216 ASSERT_TRUE(secondIsolate); |
| 223 EXPECT_EQ(firstIsolate, secondIsolate); | 217 EXPECT_EQ(firstIsolate, secondIsolate); |
| 224 | 218 |
| 225 // Verify that the isolate can run some scripts correctly in the second | 219 // Verify that the isolate can run some scripts correctly in the second |
| 226 // worklet. | 220 // worklet. |
| 227 checkWorkletCanExecuteScript(secondWorklet.get()); | 221 checkWorkletCanExecuteScript(secondWorklet.get()); |
| 228 secondWorklet->terminateAndWait(); | 222 secondWorklet->terminateAndWait(); |
| 229 } | 223 } |
| 230 | 224 |
| 231 } // namespace blink | 225 } // namespace blink |
| OLD | NEW |