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

Side by Side Diff: content/browser/shared_worker/shared_worker_host.cc

Issue 283623002: Add support for passing an arbitrary parameter to an IPC message handler. The motivation is for Web… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/embedded_worker_devtools_manager.h" 8 #include "content/browser/devtools/embedded_worker_devtools_manager.h"
9 #include "content/browser/frame_host/render_frame_host_delegate.h" 9 #include "content/browser/frame_host/render_frame_host_delegate.h"
10 #include "content/browser/frame_host/render_frame_host_impl.h" 10 #include "content/browser/frame_host/render_frame_host_impl.h"
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 url, name, instance_->resource_context(), GetRenderFrameIDsForWorker()); 230 url, name, instance_->resource_context(), GetRenderFrameIDsForWorker());
231 } 231 }
232 232
233 void SharedWorkerHost::RelayMessage( 233 void SharedWorkerHost::RelayMessage(
234 const IPC::Message& message, 234 const IPC::Message& message,
235 SharedWorkerMessageFilter* incoming_filter) { 235 SharedWorkerMessageFilter* incoming_filter) {
236 if (!instance_) 236 if (!instance_)
237 return; 237 return;
238 if (message.type() == WorkerMsg_Connect::ID) { 238 if (message.type() == WorkerMsg_Connect::ID) {
239 // Crack the SharedWorker Connect message to setup routing for the port. 239 // Crack the SharedWorker Connect message to setup routing for the port.
240 int sent_message_port_id; 240 WorkerMsg_Connect::Param param;
241 int new_routing_id; 241 if (!WorkerMsg_Connect::Read(&message, &param))
242 if (!WorkerMsg_Connect::Read(
243 &message, &sent_message_port_id, &new_routing_id)) {
244 return; 242 return;
245 } 243 int sent_message_port_id = param.a;
244 int new_routing_id = param.b;
245
246 DCHECK(container_render_filter_); 246 DCHECK(container_render_filter_);
247 new_routing_id = container_render_filter_->GetNextRoutingID(); 247 new_routing_id = container_render_filter_->GetNextRoutingID();
248 MessagePortService::GetInstance()->UpdateMessagePort( 248 MessagePortService::GetInstance()->UpdateMessagePort(
249 sent_message_port_id, 249 sent_message_port_id,
250 container_render_filter_->message_port_message_filter(), 250 container_render_filter_->message_port_message_filter(),
251 new_routing_id); 251 new_routing_id);
252 SetMessagePortID( 252 SetMessagePortID(
253 incoming_filter, message.routing_id(), sent_message_port_id); 253 incoming_filter, message.routing_id(), sent_message_port_id);
254 // Resend the message with the new routing id. 254 // Resend the message with the new routing id.
255 Send(new WorkerMsg_Connect( 255 Send(new WorkerMsg_Connect(
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 int message_port_id) { 320 int message_port_id) {
321 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) { 321 for (FilterList::iterator i = filters_.begin(); i != filters_.end(); ++i) {
322 if (i->filter() == filter && i->route_id() == route_id) { 322 if (i->filter() == filter && i->route_id() == route_id) {
323 i->set_message_port_id(message_port_id); 323 i->set_message_port_id(message_port_id);
324 return; 324 return;
325 } 325 }
326 } 326 }
327 } 327 }
328 328
329 } // namespace content 329 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698