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

Unified Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 944443003: Step two of optionally sending messages to/from message ports as base::Value. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@n-c-message-as-values-take2
Patch Set: use auto where it makes sense Created 5 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: content/child/service_worker/service_worker_dispatcher.cc
diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc
index 2a713bc8ca43f745c4903494501f694e87d2e8bf..39c23daf1f406939156786d85aa8fcf8af5d0062 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -632,7 +632,7 @@ void ServiceWorkerDispatcher::OnPostMessage(
int thread_id,
int provider_id,
const base::string16& message,
- const std::vector<int>& sent_message_port_ids,
+ const std::vector<TransferredMessagePort>& sent_message_ports,
const std::vector<int>& new_routing_ids) {
// Make sure we're on the main document thread. (That must be the only
// thread we get this message)
@@ -648,15 +648,10 @@ void ServiceWorkerDispatcher::OnPostMessage(
return;
}
- std::vector<WebMessagePortChannelImpl*> ports;
- if (!sent_message_port_ids.empty()) {
- ports.resize(sent_message_port_ids.size());
- for (size_t i = 0; i < sent_message_port_ids.size(); ++i) {
- ports[i] = new WebMessagePortChannelImpl(
- new_routing_ids[i], sent_message_port_ids[i],
- base::MessageLoopProxy::current());
- }
- }
+ blink::WebMessagePortChannelArray ports =
+ WebMessagePortChannelImpl::CreatePorts(sent_message_ports,
+ new_routing_ids,
+ base::MessageLoopProxy::current());
found->second->dispatchMessageEvent(message, ports);
}
« no previous file with comments | « content/child/service_worker/service_worker_dispatcher.h ('k') | content/child/webmessageportchannel_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698