OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #ifndef CHROME_COMMON_MESSAGE_ROUTER_H__ | 5 #ifndef BASE_MP_MESSAGE_ROUTER_H__ |
6 #define CHROME_COMMON_MESSAGE_ROUTER_H__ | 6 #define BASE_MP_MESSAGE_ROUTER_H__ |
7 | 7 |
8 #include "base/id_map.h" | 8 #include "base/id_map.h" |
9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
10 | 10 |
| 11 namespace base { |
| 12 |
11 // The MessageRouter handles all incoming messages sent to it by routing them | 13 // The MessageRouter handles all incoming messages sent to it by routing them |
12 // to the correct listener. Routing is based on the Message's routing ID. | 14 // to the correct listener. Routing is based on the Message's routing ID. |
13 // Since routing IDs are typically assigned asynchronously by the browser | 15 // Since routing IDs are typically assigned asynchronously by the browser |
14 // process, the MessageRouter has the notion of pending IDs for listeners that | 16 // process, the MessageRouter has the notion of pending IDs for listeners that |
15 // have not yet been assigned a routing ID. | 17 // have not yet been assigned a routing ID. |
16 // | 18 // |
17 // When a message arrives, the routing ID is used to index the set of routes to | 19 // When a message arrives, the routing ID is used to index the set of routes to |
18 // find a listener. If a listener is found, then the message is passed to it. | 20 // find a listener. If a listener is found, then the message is passed to it. |
19 // Otherwise, the message is ignored if its routing ID is not equal to | 21 // Otherwise, the message is ignored if its routing ID is not equal to |
20 // MSG_ROUTING_CONTROL. | 22 // MSG_ROUTING_CONTROL. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 54 |
53 IPC::Channel::Listener* ResolveRoute(int32 routing_id); | 55 IPC::Channel::Listener* ResolveRoute(int32 routing_id); |
54 | 56 |
55 private: | 57 private: |
56 // A list of all listeners with assigned routing IDs. | 58 // A list of all listeners with assigned routing IDs. |
57 IDMap<IPC::Channel::Listener> routes_; | 59 IDMap<IPC::Channel::Listener> routes_; |
58 | 60 |
59 DISALLOW_COPY_AND_ASSIGN(MessageRouter); | 61 DISALLOW_COPY_AND_ASSIGN(MessageRouter); |
60 }; | 62 }; |
61 | 63 |
62 #endif // CHROME_COMMON_MESSAGE_ROUTER_H__ | 64 } // namespace base |
| 65 |
| 66 #endif // BASE_MP_MESSAGE_ROUTER_H__ |
OLD | NEW |