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

Side by Side Diff: third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp

Issue 2806623004: Worker: Introduce per-global-scope task scheduler (Closed)
Patch Set: wip Created 3 years, 8 months 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "core/workers/ThreadedMessagingProxyBase.h" 5 #include "core/workers/ThreadedMessagingProxyBase.h"
6 6
7 #include "bindings/core/v8/SourceLocation.h" 7 #include "bindings/core/v8/SourceLocation.h"
8 #include "core/dom/Document.h" 8 #include "core/dom/Document.h"
9 #include "core/dom/TaskRunnerHelper.h"
9 #include "core/frame/Deprecation.h" 10 #include "core/frame/Deprecation.h"
10 #include "core/loader/DocumentLoader.h" 11 #include "core/loader/DocumentLoader.h"
11 #include "core/loader/ThreadableLoadingContext.h" 12 #include "core/loader/ThreadableLoadingContext.h"
12 #include "core/workers/WorkerInspectorProxy.h" 13 #include "core/workers/WorkerInspectorProxy.h"
13 #include "core/workers/WorkerThreadStartupData.h" 14 #include "core/workers/WorkerThreadStartupData.h"
14 #include "wtf/CurrentTime.h" 15 #include "wtf/CurrentTime.h"
15 16
16 namespace blink { 17 namespace blink {
17 18
18 namespace { 19 namespace {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 workerThreadCreated(); 66 workerThreadCreated();
66 } 67 }
67 68
68 void ThreadedMessagingProxyBase::postTaskToWorkerGlobalScope( 69 void ThreadedMessagingProxyBase::postTaskToWorkerGlobalScope(
69 const WebTraceLocation& location, 70 const WebTraceLocation& location,
70 std::unique_ptr<WTF::CrossThreadClosure> task) { 71 std::unique_ptr<WTF::CrossThreadClosure> task) {
71 if (m_askedToTerminate) 72 if (m_askedToTerminate)
72 return; 73 return;
73 74
74 DCHECK(m_workerThread); 75 DCHECK(m_workerThread);
75 m_workerThread->postTask(location, std::move(task)); 76 TaskRunnerHelper::get(TaskType::Networking, m_workerThread.get())
77 ->postTask(location, std::move(task));
76 } 78 }
77 79
78 void ThreadedMessagingProxyBase::postTaskToLoader( 80 void ThreadedMessagingProxyBase::postTaskToLoader(
79 const WebTraceLocation& location, 81 const WebTraceLocation& location,
80 std::unique_ptr<WTF::CrossThreadClosure> task) { 82 std::unique_ptr<WTF::CrossThreadClosure> task) {
81 m_parentFrameTaskRunners->get(TaskType::Networking) 83 m_parentFrameTaskRunners->get(TaskType::Networking)
82 ->postTask(BLINK_FROM_HERE, std::move(task)); 84 ->postTask(BLINK_FROM_HERE, std::move(task));
83 } 85 }
84 86
85 ThreadableLoadingContext* 87 ThreadableLoadingContext*
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 177 }
176 178
177 bool ThreadedMessagingProxyBase::isParentContextThread() const { 179 bool ThreadedMessagingProxyBase::isParentContextThread() const {
178 // TODO(nhiroki): Nested worker is not supported yet, so the parent context 180 // TODO(nhiroki): Nested worker is not supported yet, so the parent context
179 // thread should be equal to the main thread (http://crbug.com/31666). 181 // thread should be equal to the main thread (http://crbug.com/31666).
180 DCHECK(m_executionContext->isDocument()); 182 DCHECK(m_executionContext->isDocument());
181 return isMainThread(); 183 return isMainThread();
182 } 184 }
183 185
184 } // namespace blink 186 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698