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

Unified Diff: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp

Issue 2642113002: Worker: Reduce use of ExecutionContextTask in core/workers (Closed)
Patch Set: fix build failures Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
index 3dc90bded3066dc34a558e0e68c534336b4bc6bc..c3fd42df42551b138c48e0e11f9f15548132b58b 100644
--- a/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
+++ b/third_party/WebKit/Source/web/WebSharedWorkerImpl.cpp
@@ -322,20 +322,22 @@ void WebSharedWorkerImpl::postTaskToWorkerGlobalScope(
}
void WebSharedWorkerImpl::connect(WebMessagePortChannel* webChannel) {
+ DCHECK(isMainThread());
workerThread()->postTask(
BLINK_FROM_HERE,
- createCrossThreadTask(
- &connectTask,
- WTF::passed(WebMessagePortChannelUniquePtr(webChannel))));
+ crossThreadBind(&WebSharedWorkerImpl::connectTask,
+ WTF::crossThreadUnretained(this),
+ WTF::passed(WebMessagePortChannelUniquePtr(webChannel))));
}
-void WebSharedWorkerImpl::connectTask(WebMessagePortChannelUniquePtr channel,
- ExecutionContext* context) {
+void WebSharedWorkerImpl::connectTask(WebMessagePortChannelUniquePtr channel) {
// Wrap the passed-in channel in a MessagePort, and send it off via a connect
// event.
- MessagePort* port = MessagePort::create(*context);
+ DCHECK(m_workerThread->isCurrentThread());
+ WorkerGlobalScope* workerGlobalScope =
+ toWorkerGlobalScope(m_workerThread->globalScope());
+ MessagePort* port = MessagePort::create(*workerGlobalScope);
port->entangle(std::move(channel));
- WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context);
SECURITY_DCHECK(workerGlobalScope->isSharedWorkerGlobalScope());
workerGlobalScope->dispatchEvent(createConnectEvent(port));
}
« no previous file with comments | « third_party/WebKit/Source/web/WebSharedWorkerImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698