OLD | NEW |
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 #ifndef IPC_MESSAGE_ROUTER_H_ | 5 #ifndef IPC_MESSAGE_ROUTER_H_ |
6 #define IPC_MESSAGE_ROUTER_H_ | 6 #define IPC_MESSAGE_ROUTER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 // Sender implementation: | 52 // Sender implementation: |
53 bool Send(Message* msg) override; | 53 bool Send(Message* msg) override; |
54 | 54 |
55 // Called to add a listener for a particular message routing ID. | 55 // Called to add a listener for a particular message routing ID. |
56 // Returns true if succeeded. | 56 // Returns true if succeeded. |
57 bool AddRoute(int32_t routing_id, Listener* listener); | 57 bool AddRoute(int32_t routing_id, Listener* listener); |
58 | 58 |
59 // Called to remove a listener for a particular message routing ID. | 59 // Called to remove a listener for a particular message routing ID. |
60 void RemoveRoute(int32_t routing_id); | 60 void RemoveRoute(int32_t routing_id); |
61 | 61 |
| 62 // Returns the Listener associated with |routing_id|. |
| 63 Listener* GetRoute(int32_t routing_id); |
| 64 |
62 private: | 65 private: |
63 // A list of all listeners with assigned routing IDs. | 66 // A list of all listeners with assigned routing IDs. |
64 IDMap<Listener> routes_; | 67 IDMap<Listener> routes_; |
65 | 68 |
66 DISALLOW_COPY_AND_ASSIGN(MessageRouter); | 69 DISALLOW_COPY_AND_ASSIGN(MessageRouter); |
67 }; | 70 }; |
68 | 71 |
69 } // namespace IPC | 72 } // namespace IPC |
70 | 73 |
71 #endif // IPC_MESSAGE_ROUTER_H_ | 74 #endif // IPC_MESSAGE_ROUTER_H_ |
OLD | NEW |