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

Unified Diff: third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp

Issue 2709193002: WorkerLoaderProxy: stop accessing cross-thread execution context (Closed)
Patch Set: . Created 3 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp
diff --git a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp
index d60433aba6ccaffaec31474785c86d9b588a3450..a3fe6be4d0935e54744a8528e721856ee7dc9953 100644
--- a/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp
+++ b/third_party/WebKit/Source/core/workers/ThreadedMessagingProxyBase.cpp
@@ -72,15 +72,14 @@ void ThreadedMessagingProxyBase::postTaskToWorkerGlobalScope(
void ThreadedMessagingProxyBase::postTaskToLoader(
const WebTraceLocation& location,
- std::unique_ptr<ExecutionContextTask> task) {
- DCHECK(getExecutionContext()->isDocument());
- getParentFrameTaskRunners()
- ->get(TaskType::Networking)
- ->postTask(BLINK_FROM_HERE,
- crossThreadBind(
- &ExecutionContextTask::performTaskIfContextIsValid,
- WTF::passed(std::move(task)),
- wrapCrossThreadWeakPersistent(getExecutionContext())));
+ std::unique_ptr<WTF::CrossThreadClosure> task) {
+ m_parentFrameTaskRunners->get(TaskType::Networking)
+ ->postTask(BLINK_FROM_HERE, std::move(task));
+}
+
+ExecutionContext* ThreadedMessagingProxyBase::getLoaderExecutionContext() {
+ DCHECK(isParentContextThread());
+ return getExecutionContext();
}
void ThreadedMessagingProxyBase::countFeature(UseCounter::Feature feature) {
@@ -168,7 +167,7 @@ void ThreadedMessagingProxyBase::postMessageToPageInspector(
bool ThreadedMessagingProxyBase::isParentContextThread() const {
// TODO(nhiroki): Nested worker is not supported yet, so the parent context
// thread should be equal to the main thread (http://crbug.com/31666).
- DCHECK(getExecutionContext()->isDocument());
+ DCHECK(m_executionContext->isDocument());
return isMainThread();
}

Powered by Google App Engine
This is Rietveld 408576698