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

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

Issue 2535653002: Worker: Deprecate PostTaskToMainExecutionContext (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/loader/DocumentLoader.h" 10 #include "core/loader/DocumentLoader.h"
10 #include "core/workers/ParentFrameTaskRunners.h" 11 #include "core/workers/ParentFrameTaskRunners.h"
11 #include "core/workers/WorkerInspectorProxy.h" 12 #include "core/workers/WorkerInspectorProxy.h"
12 #include "core/workers/WorkerThreadStartupData.h" 13 #include "core/workers/WorkerThreadStartupData.h"
13 #include "wtf/CurrentTime.h" 14 #include "wtf/CurrentTime.h"
14 15
15 namespace blink { 16 namespace blink {
16 17
17 namespace { 18 namespace {
18 19
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 72
72 void ThreadedMessagingProxyBase::postTaskToLoader( 73 void ThreadedMessagingProxyBase::postTaskToLoader(
73 const WebTraceLocation& location, 74 const WebTraceLocation& location,
74 std::unique_ptr<ExecutionContextTask> task) { 75 std::unique_ptr<ExecutionContextTask> task) {
75 DCHECK(getExecutionContext()->isDocument()); 76 DCHECK(getExecutionContext()->isDocument());
76 // TODO(hiroshige,yuryu): Make this not use ExecutionContextTask and use 77 // TODO(hiroshige,yuryu): Make this not use ExecutionContextTask and use
77 // m_parentFrameTaskRunners->get(TaskType::Networking) instead. 78 // m_parentFrameTaskRunners->get(TaskType::Networking) instead.
78 getExecutionContext()->postTask(location, std::move(task)); 79 getExecutionContext()->postTask(location, std::move(task));
79 } 80 }
80 81
82 void ThreadedMessagingProxyBase::countFeature(UseCounter::Feature feature) {
83 DCHECK(isParentContextThread());
84 UseCounter::count(m_executionContext, feature);
85 }
86
87 void ThreadedMessagingProxyBase::countDeprecation(UseCounter::Feature feature) {
88 DCHECK(isParentContextThread());
89 Deprecation::countDeprecation(m_executionContext, feature);
90 }
91
81 void ThreadedMessagingProxyBase::reportConsoleMessage( 92 void ThreadedMessagingProxyBase::reportConsoleMessage(
82 MessageSource source, 93 MessageSource source,
83 MessageLevel level, 94 MessageLevel level,
84 const String& message, 95 const String& message,
85 std::unique_ptr<SourceLocation> location) { 96 std::unique_ptr<SourceLocation> location) {
86 DCHECK(isParentContextThread()); 97 DCHECK(isParentContextThread());
87 if (m_askedToTerminate) 98 if (m_askedToTerminate)
88 return; 99 return;
89 if (m_workerInspectorProxy) 100 if (m_workerInspectorProxy)
90 m_workerInspectorProxy->addConsoleMessageFromWorker(level, message, 101 m_workerInspectorProxy->addConsoleMessageFromWorker(level, message,
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 } 161 }
151 162
152 bool ThreadedMessagingProxyBase::isParentContextThread() const { 163 bool ThreadedMessagingProxyBase::isParentContextThread() const {
153 // TODO(nhiroki): Nested worker is not supported yet, so the parent context 164 // TODO(nhiroki): Nested worker is not supported yet, so the parent context
154 // thread should be equal to the main thread (http://crbug.com/31666). 165 // thread should be equal to the main thread (http://crbug.com/31666).
155 DCHECK(getExecutionContext()->isDocument()); 166 DCHECK(getExecutionContext()->isDocument());
156 return isMainThread(); 167 return isMainThread();
157 } 168 }
158 169
159 } // namespace blink 170 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698