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

Unified Diff: Source/core/dom/MessagePort.cpp

Issue 1008533005: Initial implementation of stashed message ports, blink side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase Created 5 years, 7 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 | « Source/core/dom/MessagePort.h ('k') | Source/modules/EventTargetModulesFactory.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/MessagePort.cpp
diff --git a/Source/core/dom/MessagePort.cpp b/Source/core/dom/MessagePort.cpp
index da4fa3b35c033a8a2c8b70e001f8f96f521e732d..67289c7609b81389f0d06fb4b94a7f62b1cb3497 100644
--- a/Source/core/dom/MessagePort.cpp
+++ b/Source/core/dom/MessagePort.cpp
@@ -184,6 +184,13 @@ static bool tryGetMessageFrom(WebMessagePortChannel& webChannel, RefPtr<Serializ
return true;
}
+bool MessagePort::tryGetMessage(RefPtr<SerializedScriptValue>& message, OwnPtr<MessagePortChannelArray>& channels)
+{
+ if (!m_entangledChannel)
+ return false;
+ return tryGetMessageFrom(*m_entangledChannel, message, channels);
+}
+
void MessagePort::dispatchMessages()
{
// Because close() doesn't cancel any in flight calls to dispatchMessages() we need to check if the port is still open before dispatch.
@@ -197,7 +204,7 @@ void MessagePort::dispatchMessages()
RefPtr<SerializedScriptValue> message;
OwnPtr<MessagePortChannelArray> channels;
- while (m_entangledChannel && tryGetMessageFrom(*m_entangledChannel, message, channels)) {
+ while (tryGetMessage(message, channels)) {
// close() in Worker onmessage handler should prevent next message from dispatching.
if (executionContext()->isWorkerGlobalScope() && toWorkerGlobalScope(executionContext())->isClosing())
return;
« no previous file with comments | « Source/core/dom/MessagePort.h ('k') | Source/modules/EventTargetModulesFactory.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698