diff options
Diffstat (limited to 'chrome/worker/webworkerclient_proxy.cc')
-rw-r--r-- | chrome/worker/webworkerclient_proxy.cc | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/chrome/worker/webworkerclient_proxy.cc b/chrome/worker/webworkerclient_proxy.cc index fdbaf9a..f0c6571 100644 --- a/chrome/worker/webworkerclient_proxy.cc +++ b/chrome/worker/webworkerclient_proxy.cc @@ -18,6 +18,7 @@ #include "webkit/api/public/WebWorker.h" using WebKit::WebMessagePortChannel; +using WebKit::WebMessagePortChannelArray; using WebKit::WebString; using WebKit::WebWorker; using WebKit::WebWorkerClient; @@ -81,18 +82,20 @@ WebWorkerClientProxy::~WebWorkerClientProxy() { void WebWorkerClientProxy::postMessageToWorkerObject( const WebString& message, - WebMessagePortChannel* channel) { - int message_port_id = MSG_ROUTING_NONE; - if (channel) { + const WebMessagePortChannelArray& channels) { + std::vector<int> message_port_ids(channels.size()); + std::vector<int> routing_ids(channels.size()); + for (size_t i = 0; i < channels.size(); ++i) { WebMessagePortChannelImpl* webchannel = - static_cast<WebMessagePortChannelImpl*>(channel); - message_port_id = webchannel->message_port_id(); + static_cast<WebMessagePortChannelImpl*>(channels[i]); + message_port_ids[i] = webchannel->message_port_id(); webchannel->QueueMessages(); - DCHECK(message_port_id != MSG_ROUTING_NONE); + DCHECK(message_port_ids[i] != MSG_ROUTING_NONE); + routing_ids[i] = MSG_ROUTING_NONE; } Send(new WorkerMsg_PostMessage( - route_id_, message, message_port_id, MSG_ROUTING_NONE)); + route_id_, message, message_port_ids, routing_ids)); } void WebWorkerClientProxy::postExceptionToWorkerObject( @@ -179,14 +182,15 @@ void WebWorkerClientProxy::OnTerminateWorkerContext() { new KillProcessTask(this), kMaxTimeForRunawayWorkerMs); } -void WebWorkerClientProxy::OnPostMessage(const string16& message, - int sent_message_port_id, - int new_routing_id) { - WebMessagePortChannel* channel = NULL; - if (sent_message_port_id != MSG_ROUTING_NONE) { - channel = new WebMessagePortChannelImpl( - new_routing_id, sent_message_port_id); +void WebWorkerClientProxy::OnPostMessage( + const string16& message, + const std::vector<int>& sent_message_port_ids, + const std::vector<int>& new_routing_ids) { + WebMessagePortChannelArray channels(sent_message_port_ids.size()); + for (size_t i = 0; i < sent_message_port_ids.size(); i++) { + channels[i] = new WebMessagePortChannelImpl( + new_routing_ids[i], sent_message_port_ids[i]); } - impl_->postMessageToWorkerContext(message, channel); + impl_->postMessageToWorkerContext(message, channels); } |