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

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

Issue 2143003003: Delay client registration of MessagePort to MessagePortChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/close()/DCHECK/ Created 4 years, 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/MessagePort.cpp
diff --git a/third_party/WebKit/Source/core/dom/MessagePort.cpp b/third_party/WebKit/Source/core/dom/MessagePort.cpp
index 92e9facdd5da448fbb0c1b20551f3e6de72fada8..567c32dc900b7d0b27fbc696a2d316dfc03b9059 100644
--- a/third_party/WebKit/Source/core/dom/MessagePort.cpp
+++ b/third_party/WebKit/Source/core/dom/MessagePort.cpp
@@ -62,7 +62,7 @@ MessagePort::MessagePort(ExecutionContext& executionContext)
MessagePort::~MessagePort()
{
- close();
+ DCHECK(!m_started || !isEntangled());
if (m_scriptStateForConversion)
m_scriptStateForConversion->disposePerContextData();
}
@@ -117,7 +117,7 @@ MessagePortArray* MessagePort::toMessagePortArray(ExecutionContext* context, con
WebMessagePortChannelUniquePtr MessagePort::disentangle()
{
DCHECK(m_entangledChannel);
- m_entangledChannel->setClient(0);
+ m_entangledChannel->setClient(nullptr);
return std::move(m_entangledChannel);
}
@@ -139,6 +139,7 @@ void MessagePort::start()
if (m_started)
return;
+ m_entangledChannel->setClient(this);
m_started = true;
messageAvailable();
}
@@ -146,7 +147,7 @@ void MessagePort::start()
void MessagePort::close()
{
if (isEntangled())
- m_entangledChannel->setClient(0);
+ m_entangledChannel->setClient(nullptr);
m_closed = true;
}
@@ -157,7 +158,6 @@ void MessagePort::entangle(WebMessagePortChannelUniquePtr remote)
DCHECK(getExecutionContext());
m_entangledChannel = std::move(remote);
- m_entangledChannel->setClient(this);
}
const AtomicString& MessagePort::interfaceName() const
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698