OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/shared_worker/shared_worker_host.h" | 5 #include "content/browser/shared_worker/shared_worker_host.h" |
6 | 6 |
7 #include "base/metrics/histogram.h" | 7 #include "base/metrics/histogram.h" |
8 #include "content/browser/devtools/shared_worker_devtools_manager.h" | 8 #include "content/browser/devtools/shared_worker_devtools_manager.h" |
9 #include "content/browser/message_port_message_filter.h" | 9 #include "content/browser/message_port_message_filter.h" |
10 #include "content/browser/message_port_service.h" | 10 #include "content/browser/message_port_service.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 void SharedWorkerHost::RelayMessage( | 217 void SharedWorkerHost::RelayMessage( |
218 const IPC::Message& message, | 218 const IPC::Message& message, |
219 SharedWorkerMessageFilter* incoming_filter) { | 219 SharedWorkerMessageFilter* incoming_filter) { |
220 if (!instance_) | 220 if (!instance_) |
221 return; | 221 return; |
222 if (message.type() == WorkerMsg_Connect::ID) { | 222 if (message.type() == WorkerMsg_Connect::ID) { |
223 // Crack the SharedWorker Connect message to setup routing for the port. | 223 // Crack the SharedWorker Connect message to setup routing for the port. |
224 WorkerMsg_Connect::Param param; | 224 WorkerMsg_Connect::Param param; |
225 if (!WorkerMsg_Connect::Read(&message, ¶m)) | 225 if (!WorkerMsg_Connect::Read(&message, ¶m)) |
226 return; | 226 return; |
227 int sent_message_port_id = base::get<0>(param); | 227 int sent_message_port_id = std::get<0>(param); |
228 int new_routing_id = base::get<1>(param); | 228 int new_routing_id = std::get<1>(param); |
229 | 229 |
230 DCHECK(container_render_filter_); | 230 DCHECK(container_render_filter_); |
231 new_routing_id = container_render_filter_->GetNextRoutingID(); | 231 new_routing_id = container_render_filter_->GetNextRoutingID(); |
232 MessagePortService::GetInstance()->UpdateMessagePort( | 232 MessagePortService::GetInstance()->UpdateMessagePort( |
233 sent_message_port_id, | 233 sent_message_port_id, |
234 container_render_filter_->message_port_message_filter(), | 234 container_render_filter_->message_port_message_filter(), |
235 new_routing_id); | 235 new_routing_id); |
236 SetMessagePortID( | 236 SetMessagePortID( |
237 incoming_filter, message.routing_id(), sent_message_port_id); | 237 incoming_filter, message.routing_id(), sent_message_port_id); |
238 // Resend the message with the new routing id. | 238 // Resend the message with the new routing id. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 int message_port_id) { | 311 int message_port_id) { |
312 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { | 312 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { |
313 if (i->filter() == filter && i->route_id() == route_id) { | 313 if (i->filter() == filter && i->route_id() == route_id) { |
314 i->set_message_port_id(message_port_id); | 314 i->set_message_port_id(message_port_id); |
315 return; | 315 return; |
316 } | 316 } |
317 } | 317 } |
318 } | 318 } |
319 | 319 |
320 } // namespace content | 320 } // namespace content |
OLD | NEW |