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

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

Issue 2518073002: Worker: Use per-frame task runners from a worker thread (Closed)
Patch Set: rebase 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/CompositorWorkerThread.h" 5 #include "modules/compositorworker/CompositorWorkerThread.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/dom/CompositorProxyClient.h" 11 #include "core/dom/CompositorProxyClient.h"
12 #include "core/inspector/ConsoleMessage.h" 12 #include "core/inspector/ConsoleMessage.h"
13 #include "core/testing/DummyPageHolder.h" 13 #include "core/testing/DummyPageHolder.h"
14 #include "core/workers/InProcessWorkerObjectProxy.h" 14 #include "core/workers/InProcessWorkerObjectProxy.h"
15 #include "core/workers/ParentFrameTaskRunners.h"
15 #include "core/workers/WorkerBackingThread.h" 16 #include "core/workers/WorkerBackingThread.h"
16 #include "core/workers/WorkerLoaderProxy.h" 17 #include "core/workers/WorkerLoaderProxy.h"
17 #include "core/workers/WorkerOrWorkletGlobalScope.h" 18 #include "core/workers/WorkerOrWorkletGlobalScope.h"
18 #include "core/workers/WorkerThreadStartupData.h" 19 #include "core/workers/WorkerThreadStartupData.h"
19 #include "platform/CrossThreadFunctional.h" 20 #include "platform/CrossThreadFunctional.h"
20 #include "platform/WaitableEvent.h" 21 #include "platform/WaitableEvent.h"
21 #include "platform/WebThreadSupportingGC.h" 22 #include "platform/WebThreadSupportingGC.h"
22 #include "platform/heap/Handle.h" 23 #include "platform/heap/Handle.h"
23 #include "platform/testing/TestingPlatformSupport.h" 24 #include "platform/testing/TestingPlatformSupport.h"
24 #include "platform/testing/UnitTestHelpers.h" 25 #include "platform/testing/UnitTestHelpers.h"
(...skipping 17 matching lines...) Expand all
42 43
43 // (Empty) WorkerReportingProxy implementation: 44 // (Empty) WorkerReportingProxy implementation:
44 virtual void dispatchErrorEvent(const String& errorMessage, 45 virtual void dispatchErrorEvent(const String& errorMessage,
45 std::unique_ptr<SourceLocation>, 46 std::unique_ptr<SourceLocation>,
46 int exceptionId) {} 47 int exceptionId) {}
47 void reportConsoleMessage(MessageSource, 48 void reportConsoleMessage(MessageSource,
48 MessageLevel, 49 MessageLevel,
49 const String& message, 50 const String& message,
50 SourceLocation*) override {} 51 SourceLocation*) override {}
51 void postMessageToPageInspector(const String&) override {} 52 void postMessageToPageInspector(const String&) override {}
53 ParentFrameTaskRunners* getParentFrameTaskRunners() override {
54 return m_parentFrameTaskRunners.get();
55 }
52 56
53 void didCreateWorkerGlobalScope(WorkerOrWorkletGlobalScope*) override {} 57 void didCreateWorkerGlobalScope(WorkerOrWorkletGlobalScope*) override {}
54 void didEvaluateWorkerScript(bool success) override {} 58 void didEvaluateWorkerScript(bool success) override {}
55 void didCloseWorkerGlobalScope() override {} 59 void didCloseWorkerGlobalScope() override {}
56 void willDestroyWorkerGlobalScope() override {} 60 void willDestroyWorkerGlobalScope() override {}
57 void didTerminateWorkerThread() override {} 61 void didTerminateWorkerThread() override {}
58 62
59 ExecutionContext* getExecutionContext() override { 63 ExecutionContext* getExecutionContext() override {
60 return m_executionContext.get(); 64 return m_executionContext.get();
61 } 65 }
62 66
63 private: 67 private:
64 TestCompositorWorkerObjectProxy(ExecutionContext* context) 68 TestCompositorWorkerObjectProxy(ExecutionContext* context)
65 : InProcessWorkerObjectProxy(nullptr), m_executionContext(context) {} 69 : InProcessWorkerObjectProxy(nullptr),
70 m_executionContext(context),
71 m_parentFrameTaskRunners(ParentFrameTaskRunners::create(nullptr)) {}
66 72
67 Persistent<ExecutionContext> m_executionContext; 73 Persistent<ExecutionContext> m_executionContext;
74 Persistent<ParentFrameTaskRunners> m_parentFrameTaskRunners;
68 }; 75 };
69 76
70 class TestCompositorProxyClient 77 class TestCompositorProxyClient
71 : public GarbageCollected<TestCompositorProxyClient>, 78 : public GarbageCollected<TestCompositorProxyClient>,
72 public CompositorProxyClient { 79 public CompositorProxyClient {
73 USING_GARBAGE_COLLECTED_MIXIN(TestCompositorProxyClient); 80 USING_GARBAGE_COLLECTED_MIXIN(TestCompositorProxyClient);
74 81
75 public: 82 public:
76 TestCompositorProxyClient() {} 83 TestCompositorProxyClient() {}
77 84
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 ASSERT_TRUE(secondIsolate); 253 ASSERT_TRUE(secondIsolate);
247 EXPECT_EQ(firstIsolate, secondIsolate); 254 EXPECT_EQ(firstIsolate, secondIsolate);
248 255
249 // Verify that the isolate can run some scripts correctly in the second 256 // Verify that the isolate can run some scripts correctly in the second
250 // worker. 257 // worker.
251 checkWorkerCanExecuteScript(secondWorker.get()); 258 checkWorkerCanExecuteScript(secondWorker.get());
252 secondWorker->terminateAndWait(); 259 secondWorker->terminateAndWait();
253 } 260 }
254 261
255 } // namespace blink 262 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerThreadTest.cpp ('k') | third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698