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

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

Issue 2422793002: HTML MessagePort as mojo::MessagePipeHandle (Closed)
Patch Set: Add missing ScopedAsyncTaskScheduler instance for the new unit tests; required by a recent change t… 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/web/WebDOMMessageEvent.cpp
diff --git a/third_party/WebKit/Source/web/WebDOMMessageEvent.cpp b/third_party/WebKit/Source/web/WebDOMMessageEvent.cpp
index 897bb6de313ae8e86e50acbb2f795e3fe2393c16..c51b4fc4faf4ccf69b603f3e97db7373812304f2 100644
--- a/third_party/WebKit/Source/web/WebDOMMessageEvent.cpp
+++ b/third_party/WebKit/Source/web/WebDOMMessageEvent.cpp
@@ -48,7 +48,7 @@ WebDOMMessageEvent::WebDOMMessageEvent(
const WebString& origin,
const WebFrame* sourceFrame,
const WebDocument& targetDocument,
- const WebMessagePortChannelArray& channels)
+ WebMessagePortChannelArray channels)
: WebDOMMessageEvent(MessageEvent::create()) {
DOMWindow* window = nullptr;
if (sourceFrame)
@@ -56,7 +56,7 @@ WebDOMMessageEvent::WebDOMMessageEvent(
MessagePortArray* ports = nullptr;
if (!targetDocument.isNull()) {
Document* coreDocument = targetDocument;
- ports = MessagePort::toMessagePortArray(coreDocument, channels);
+ ports = MessagePort::toMessagePortArray(coreDocument, std::move(channels));
}
// Use an empty array for |ports| when it is null because this function
// is used to implement postMessage().
@@ -79,12 +79,10 @@ WebString WebDOMMessageEvent::origin() const {
}
WebMessagePortChannelArray WebDOMMessageEvent::releaseChannels() {
- MessagePortChannelArray* channels = constUnwrap<MessageEvent>()->channels();
- WebMessagePortChannelArray webChannels(channels ? channels->size() : 0);
- if (channels) {
- for (size_t i = 0; i < channels->size(); ++i)
- webChannels[i] = (*channels)[i].release();
- }
+ MessagePortChannelArray channels = unwrap<MessageEvent>()->releaseChannels();
+ WebMessagePortChannelArray webChannels(channels.size());
+ for (size_t i = 0; i < channels.size(); ++i)
+ webChannels[i] = std::move(channels[i]);
return webChannels;
}

Powered by Google App Engine
This is Rietveld 408576698