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

Side by Side Diff: content/browser/worker_host/worker_process_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/worker_host/worker_process_host.h" 5 #include "content/browser/worker_host/worker_process_host.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 else 503 else
504 RecordAction(base::UserMetricsAction("WorkerProcess_BadProcessToKill")); 504 RecordAction(base::UserMetricsAction("WorkerProcess_BadProcessToKill"));
505 } 505 }
506 506
507 void WorkerProcessHost::RelayMessage( 507 void WorkerProcessHost::RelayMessage(
508 const IPC::Message& message, 508 const IPC::Message& message,
509 WorkerMessageFilter* incoming_filter, 509 WorkerMessageFilter* incoming_filter,
510 WorkerInstance* instance) { 510 WorkerInstance* instance) {
511 if (message.type() == WorkerMsg_Connect::ID) { 511 if (message.type() == WorkerMsg_Connect::ID) {
512 // Crack the SharedWorker Connect message to setup routing for the port. 512 // Crack the SharedWorker Connect message to setup routing for the port.
513 int sent_message_port_id; 513 WorkerMsg_Connect::Param params;
514 int new_routing_id; 514 if (!WorkerMsg_Connect::Read(&message, &params))
515 if (!WorkerMsg_Connect::Read(
516 &message, &sent_message_port_id, &new_routing_id)) {
517 return; 515 return;
518 } 516
517 int sent_message_port_id = params.a;
518 int new_routing_id = params.b;
519 new_routing_id = worker_message_filter_->GetNextRoutingID(); 519 new_routing_id = worker_message_filter_->GetNextRoutingID();
520 MessagePortService::GetInstance()->UpdateMessagePort( 520 MessagePortService::GetInstance()->UpdateMessagePort(
521 sent_message_port_id, 521 sent_message_port_id,
522 worker_message_filter_->message_port_message_filter(), 522 worker_message_filter_->message_port_message_filter(),
523 new_routing_id); 523 new_routing_id);
524 524
525 instance->SetMessagePortID(incoming_filter, 525 instance->SetMessagePortID(incoming_filter,
526 message.routing_id(), 526 message.routing_id(),
527 sent_message_port_id); 527 sent_message_port_id);
528 // Resend the message with the new routing id. 528 // Resend the message with the new routing id.
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
828 return false; 828 return false;
829 } 829 }
830 830
831 WorkerProcessHost::WorkerInstance::FilterInfo 831 WorkerProcessHost::WorkerInstance::FilterInfo
832 WorkerProcessHost::WorkerInstance::GetFilter() const { 832 WorkerProcessHost::WorkerInstance::GetFilter() const {
833 DCHECK(NumFilters() == 1); 833 DCHECK(NumFilters() == 1);
834 return *filters_.begin(); 834 return *filters_.begin();
835 } 835 }
836 836
837 } // namespace content 837 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/shared_worker/shared_worker_service_impl_unittest.cc ('k') | content/child/resource_dispatcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698