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 16 matching lines...) Expand all Loading... |
27 #include "wtf/PtrUtil.h" | 27 #include "wtf/PtrUtil.h" |
28 #include <memory> | 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 wrapUnique(new TestAnimationWorkletReportingProxy()); | 37 return WTF::wrapUnique(new TestAnimationWorkletReportingProxy()); |
38 } | 38 } |
39 | 39 |
40 // (Empty) WorkerReportingProxy implementation: | 40 // (Empty) WorkerReportingProxy implementation: |
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, |
(...skipping 12 matching lines...) Expand all Loading... |
60 private: | 60 private: |
61 TestAnimationWorkletReportingProxy() | 61 TestAnimationWorkletReportingProxy() |
62 : m_parentFrameTaskRunners(ParentFrameTaskRunners::create(nullptr)) {} | 62 : m_parentFrameTaskRunners(ParentFrameTaskRunners::create(nullptr)) {} |
63 | 63 |
64 Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners; | 64 Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners; |
65 }; | 65 }; |
66 | 66 |
67 class AnimationWorkletTestPlatform : public TestingPlatformSupport { | 67 class AnimationWorkletTestPlatform : public TestingPlatformSupport { |
68 public: | 68 public: |
69 AnimationWorkletTestPlatform() | 69 AnimationWorkletTestPlatform() |
70 : m_thread(wrapUnique(m_oldPlatform->createThread("Compositor"))) {} | 70 : m_thread(WTF::wrapUnique(m_oldPlatform->createThread("Compositor"))) {} |
71 | 71 |
72 WebThread* compositorThread() const override { return m_thread.get(); } | 72 WebThread* compositorThread() const override { return m_thread.get(); } |
73 | 73 |
74 WebCompositorSupport* compositorSupport() override { | 74 WebCompositorSupport* compositorSupport() override { |
75 return &m_compositorSupport; | 75 return &m_compositorSupport; |
76 } | 76 } |
77 | 77 |
78 private: | 78 private: |
79 std::unique_ptr<WebThread> m_thread; | 79 std::unique_ptr<WebThread> m_thread; |
80 TestingCompositorSupport m_compositorSupport; | 80 TestingCompositorSupport m_compositorSupport; |
(...skipping 20 matching lines...) Expand all Loading... |
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 V8CacheOptionsDefault)); |
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 = 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), |
116 crossThreadUnretained(thread), | 116 crossThreadUnretained(thread), |
117 crossThreadUnretained(waitEvent.get()))); | 117 crossThreadUnretained(waitEvent.get()))); |
118 waitEvent->wait(); | 118 waitEvent->wait(); |
119 } | 119 } |
120 | 120 |
121 private: | 121 private: |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 ASSERT_TRUE(secondIsolate); | 220 ASSERT_TRUE(secondIsolate); |
221 EXPECT_EQ(firstIsolate, secondIsolate); | 221 EXPECT_EQ(firstIsolate, secondIsolate); |
222 | 222 |
223 // Verify that the isolate can run some scripts correctly in the second | 223 // Verify that the isolate can run some scripts correctly in the second |
224 // worklet. | 224 // worklet. |
225 checkWorkletCanExecuteScript(secondWorklet.get()); | 225 checkWorkletCanExecuteScript(secondWorklet.get()); |
226 secondWorklet->terminateAndWait(); | 226 secondWorklet->terminateAndWait(); |
227 } | 227 } |
228 | 228 |
229 } // namespace blink | 229 } // namespace blink |
OLD | NEW |