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

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

Issue 2574703002: Use ParentFrameTaskRunners in WorkerLoaderProxyProvider::postTaskToLoader impls (Closed)
Patch Set: . 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 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/frame/Deprecation.h" 9 #include "core/frame/Deprecation.h"
10 #include "core/loader/DocumentLoader.h" 10 #include "core/loader/DocumentLoader.h"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 return; 67 return;
68 68
69 DCHECK(m_workerThread); 69 DCHECK(m_workerThread);
70 m_workerThread->postTask(location, std::move(task)); 70 m_workerThread->postTask(location, std::move(task));
71 } 71 }
72 72
73 void ThreadedMessagingProxyBase::postTaskToLoader( 73 void ThreadedMessagingProxyBase::postTaskToLoader(
74 const WebTraceLocation& location, 74 const WebTraceLocation& location,
75 std::unique_ptr<ExecutionContextTask> task) { 75 std::unique_ptr<ExecutionContextTask> task) {
76 DCHECK(getExecutionContext()->isDocument()); 76 DCHECK(getExecutionContext()->isDocument());
77 // TODO(hiroshige,yuryu): Make this not use ExecutionContextTask and use 77 m_parentFrameTaskRunners->get(TaskType::Networking)
78 // m_parentFrameTaskRunners->get(TaskType::Networking) instead. 78 ->postTask(BLINK_FROM_HERE,
79 getExecutionContext()->postTask(location, std::move(task)); 79 crossThreadBind(
80 &ExecutionContextTask::performTaskIfContextIsValid,
81 WTF::passed(std::move(task)),
82 wrapCrossThreadWeakPersistent(getExecutionContext())));
80 } 83 }
81 84
82 void ThreadedMessagingProxyBase::countFeature(UseCounter::Feature feature) { 85 void ThreadedMessagingProxyBase::countFeature(UseCounter::Feature feature) {
83 DCHECK(isParentContextThread()); 86 DCHECK(isParentContextThread());
84 UseCounter::count(m_executionContext, feature); 87 UseCounter::count(m_executionContext, feature);
85 } 88 }
86 89
87 void ThreadedMessagingProxyBase::countDeprecation(UseCounter::Feature feature) { 90 void ThreadedMessagingProxyBase::countDeprecation(UseCounter::Feature feature) {
88 DCHECK(isParentContextThread()); 91 DCHECK(isParentContextThread());
89 Deprecation::countDeprecation(m_executionContext, feature); 92 Deprecation::countDeprecation(m_executionContext, feature);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 } 164 }
162 165
163 bool ThreadedMessagingProxyBase::isParentContextThread() const { 166 bool ThreadedMessagingProxyBase::isParentContextThread() const {
164 // TODO(nhiroki): Nested worker is not supported yet, so the parent context 167 // TODO(nhiroki): Nested worker is not supported yet, so the parent context
165 // thread should be equal to the main thread (http://crbug.com/31666). 168 // thread should be equal to the main thread (http://crbug.com/31666).
166 DCHECK(getExecutionContext()->isDocument()); 169 DCHECK(getExecutionContext()->isDocument());
167 return isMainThread(); 170 return isMainThread();
168 } 171 }
169 172
170 } // namespace blink 173 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698