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

Side by Side Diff: chrome/common/message_router.cc

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 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
« no previous file with comments | « chrome/common/message_router.h ('k') | chrome/common/resource_dispatcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/common/message_router.h" 5 #include "chrome/common/message_router.h"
6 6
7 MessageRouter::MessageRouter() { 7 MessageRouter::MessageRouter() {
8 } 8 }
9 9
10 MessageRouter::~MessageRouter() { 10 MessageRouter::~MessageRouter() {
11 } 11 }
12 12
13 void MessageRouter::OnControlMessageReceived(const IPC::Message& msg) { 13 bool MessageRouter::OnControlMessageReceived(const IPC::Message& msg) {
14 NOTREACHED() << 14 NOTREACHED() <<
15 "should override in subclass if you care about control messages"; 15 "should override in subclass if you care about control messages";
16 return false;
16 } 17 }
17 18
18 bool MessageRouter::Send(IPC::Message* msg) { 19 bool MessageRouter::Send(IPC::Message* msg) {
19 NOTREACHED() << 20 NOTREACHED() <<
20 "should override in subclass if you care about sending messages"; 21 "should override in subclass if you care about sending messages";
21 return false; 22 return false;
22 } 23 }
23 24
24 void MessageRouter::AddRoute(int32 routing_id, 25 void MessageRouter::AddRoute(int32 routing_id,
25 IPC::Channel::Listener* listener) { 26 IPC::Channel::Listener* listener) {
26 routes_.AddWithID(listener, routing_id); 27 routes_.AddWithID(listener, routing_id);
27 } 28 }
28 29
29 void MessageRouter::RemoveRoute(int32 routing_id) { 30 void MessageRouter::RemoveRoute(int32 routing_id) {
30 routes_.Remove(routing_id); 31 routes_.Remove(routing_id);
31 } 32 }
32 33
33 void MessageRouter::OnMessageReceived(const IPC::Message& msg) { 34 bool MessageRouter::OnMessageReceived(const IPC::Message& msg) {
34 if (msg.routing_id() == MSG_ROUTING_CONTROL) { 35 if (msg.routing_id() == MSG_ROUTING_CONTROL)
35 OnControlMessageReceived(msg); 36 return OnControlMessageReceived(msg);
36 } else { 37
37 RouteMessage(msg); 38 return RouteMessage(msg);
38 }
39 } 39 }
40 40
41 bool MessageRouter::RouteMessage(const IPC::Message& msg) { 41 bool MessageRouter::RouteMessage(const IPC::Message& msg) {
42 IPC::Channel::Listener* listener = ResolveRoute(msg.routing_id()); 42 IPC::Channel::Listener* listener = ResolveRoute(msg.routing_id());
43 if (!listener) 43 if (!listener)
44 return false; 44 return false;
45 45
46 listener->OnMessageReceived(msg); 46 listener->OnMessageReceived(msg);
47 return true; 47 return true;
48 } 48 }
49 49
50 IPC::Channel::Listener* MessageRouter::ResolveRoute(int32 routing_id) { 50 IPC::Channel::Listener* MessageRouter::ResolveRoute(int32 routing_id) {
51 return routes_.Lookup(routing_id); 51 return routes_.Lookup(routing_id);
52 } 52 }
OLDNEW
« no previous file with comments | « chrome/common/message_router.h ('k') | chrome/common/resource_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698