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

Unified Diff: content/child/webmessageportchannel_impl.cc

Issue 1192713004: Update client side navigator.connect API to use ServicePortCollection [2/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 6 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 | « content/child/webmessageportchannel_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/webmessageportchannel_impl.cc
diff --git a/content/child/webmessageportchannel_impl.cc b/content/child/webmessageportchannel_impl.cc
index 1e10a245dbfe64e3a09020d91425fcecc692c0de..4bcd4392b7ad807f573f7957484400343784b2c6 100644
--- a/content/child/webmessageportchannel_impl.cc
+++ b/content/child/webmessageportchannel_impl.cc
@@ -119,6 +119,32 @@ WebMessagePortChannelImpl::ExtractMessagePortIDs(
}
// static
+std::vector<TransferredMessagePort>
+WebMessagePortChannelImpl::ExtractMessagePortIDsWithoutQueueing(
+ scoped_ptr<WebMessagePortChannelArray> channels) {
+ if (!channels)
+ return std::vector<TransferredMessagePort>();
+
+ std::vector<TransferredMessagePort> message_ports(channels->size());
+ for (size_t i = 0; i < channels->size(); ++i) {
+ WebMessagePortChannelImpl* webchannel =
+ static_cast<WebMessagePortChannelImpl*>((*channels)[i]);
+ // The message port ids might not be set up yet if this channel
+ // wasn't created on the main thread.
+ DCHECK(webchannel->main_thread_task_runner_->BelongsToCurrentThread());
+ message_ports[i].id = webchannel->message_port_id();
+ message_ports[i].send_messages_as_values =
+ webchannel->send_messages_as_values_;
+ // Don't queue messages, but do increase the child processes ref-count to
+ // ensure this child process stays alive long enough to receive all
+ // in-flight messages.
+ ChildProcess::current()->AddRefProcess();
+ DCHECK(message_ports[i].id != MSG_ROUTING_NONE);
+ }
+ return message_ports;
+}
+
+// static
WebMessagePortChannelArray WebMessagePortChannelImpl::CreatePorts(
const std::vector<TransferredMessagePort>& message_ports,
const std::vector<int>& new_routing_ids,
« no previous file with comments | « content/child/webmessageportchannel_impl.h ('k') | content/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698