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

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

Issue 2513413003: Worker: Provide a way to access parent frame task runners from a worker thread (Closed)
Patch Set: update comments Created 4 years 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 "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"
11 #include "core/inspector/ConsoleMessage.h" 11 #include "core/inspector/ConsoleMessage.h"
12 #include "core/workers/InProcessWorkerObjectProxy.h" 12 #include "core/workers/InProcessWorkerObjectProxy.h"
13 #include "core/workers/ParentFrameTaskRunners.h"
13 #include "core/workers/WorkerBackingThread.h" 14 #include "core/workers/WorkerBackingThread.h"
14 #include "core/workers/WorkerLoaderProxy.h" 15 #include "core/workers/WorkerLoaderProxy.h"
15 #include "core/workers/WorkerOrWorkletGlobalScope.h" 16 #include "core/workers/WorkerOrWorkletGlobalScope.h"
16 #include "core/workers/WorkerThreadStartupData.h" 17 #include "core/workers/WorkerThreadStartupData.h"
17 #include "platform/CrossThreadFunctional.h" 18 #include "platform/CrossThreadFunctional.h"
18 #include "platform/WaitableEvent.h" 19 #include "platform/WaitableEvent.h"
19 #include "platform/WebThreadSupportingGC.h" 20 #include "platform/WebThreadSupportingGC.h"
20 #include "platform/heap/Handle.h" 21 #include "platform/heap/Handle.h"
21 #include "platform/testing/TestingPlatformSupport.h" 22 #include "platform/testing/TestingPlatformSupport.h"
22 #include "platform/testing/UnitTestHelpers.h" 23 #include "platform/testing/UnitTestHelpers.h"
(...skipping 15 matching lines...) Expand all
38 39
39 // (Empty) WorkerReportingProxy implementation: 40 // (Empty) WorkerReportingProxy implementation:
40 void reportException(const String& errorMessage, 41 void reportException(const String& errorMessage,
41 std::unique_ptr<SourceLocation>, 42 std::unique_ptr<SourceLocation>,
42 int exceptionId) override {} 43 int exceptionId) override {}
43 void reportConsoleMessage(MessageSource, 44 void reportConsoleMessage(MessageSource,
44 MessageLevel, 45 MessageLevel,
45 const String& message, 46 const String& message,
46 SourceLocation*) override {} 47 SourceLocation*) override {}
47 void postMessageToPageInspector(const String&) override {} 48 void postMessageToPageInspector(const String&) override {}
49 ParentFrameTaskRunners* getParentFrameTaskRunners() override {
50 return m_parentFrameTaskRunners.get();
51 }
48 52
49 void didEvaluateWorkerScript(bool success) override {} 53 void didEvaluateWorkerScript(bool success) override {}
50 void didCloseWorkerGlobalScope() override {} 54 void didCloseWorkerGlobalScope() override {}
51 void willDestroyWorkerGlobalScope() override {} 55 void willDestroyWorkerGlobalScope() override {}
52 void didTerminateWorkerThread() override {} 56 void didTerminateWorkerThread() override {}
53 57
54 private: 58 private:
55 TestAnimationWorkletReportingProxy() {} 59 TestAnimationWorkletReportingProxy()
60 : m_parentFrameTaskRunners(ParentFrameTaskRunners::create(nullptr)) {}
61
62 Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners;
56 }; 63 };
57 64
58 class AnimationWorkletTestPlatform : public TestingPlatformSupport { 65 class AnimationWorkletTestPlatform : public TestingPlatformSupport {
59 public: 66 public:
60 AnimationWorkletTestPlatform() 67 AnimationWorkletTestPlatform()
61 : m_thread(wrapUnique(m_oldPlatform->createThread("Compositor"))) {} 68 : m_thread(wrapUnique(m_oldPlatform->createThread("Compositor"))) {}
62 69
63 WebThread* compositorThread() const override { return m_thread.get(); } 70 WebThread* compositorThread() const override { return m_thread.get(); }
64 71
65 WebCompositorSupport* compositorSupport() override { 72 WebCompositorSupport* compositorSupport() override {
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 ASSERT_TRUE(secondIsolate); 218 ASSERT_TRUE(secondIsolate);
212 EXPECT_EQ(firstIsolate, secondIsolate); 219 EXPECT_EQ(firstIsolate, secondIsolate);
213 220
214 // Verify that the isolate can run some scripts correctly in the second 221 // Verify that the isolate can run some scripts correctly in the second
215 // worklet. 222 // worklet.
216 checkWorkletCanExecuteScript(secondWorklet.get()); 223 checkWorkletCanExecuteScript(secondWorklet.get());
217 secondWorklet->terminateAndWait(); 224 secondWorklet->terminateAndWait();
218 } 225 }
219 226
220 } // namespace blink 227 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698