OLD | NEW |
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 #ifndef IPC_IPC_MESSAGE_H__ | 5 #ifndef IPC_IPC_MESSAGE_H__ |
6 #define IPC_IPC_MESSAGE_H__ | 6 #define IPC_IPC_MESSAGE_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 123 } |
124 | 124 |
125 int32 routing_id() const { | 125 int32 routing_id() const { |
126 return header()->routing; | 126 return header()->routing; |
127 } | 127 } |
128 | 128 |
129 void set_routing_id(int32 new_id) { | 129 void set_routing_id(int32 new_id) { |
130 header()->routing = new_id; | 130 header()->routing = new_id; |
131 } | 131 } |
132 | 132 |
133 template<class T> | 133 template<class T, class S> |
134 static bool Dispatch(const Message* msg, T* obj, void (T::*func)()) { | 134 static bool Dispatch(const Message* msg, T* obj, S* sender, |
| 135 void (T::*func)()) { |
135 (obj->*func)(); | 136 (obj->*func)(); |
136 return true; | 137 return true; |
137 } | 138 } |
138 | 139 |
139 template<class T> | 140 template<class T, class S> |
140 static bool Dispatch(const Message* msg, T* obj, void (T::*func)() const) { | 141 static bool Dispatch(const Message* msg, T* obj, S* sender, |
| 142 void (T::*func)() const) { |
141 (obj->*func)(); | 143 (obj->*func)(); |
142 return true; | 144 return true; |
143 } | 145 } |
144 | 146 |
145 template<class T> | 147 template<class T, class S> |
146 static bool Dispatch(const Message* msg, T* obj, | 148 static bool Dispatch(const Message* msg, T* obj, S* sender, |
147 void (T::*func)(const Message&)) { | 149 void (T::*func)(const Message&)) { |
148 (obj->*func)(*msg); | 150 (obj->*func)(*msg); |
149 return true; | 151 return true; |
150 } | 152 } |
151 | 153 |
152 template<class T> | 154 template<class T, class S> |
153 static bool Dispatch(const Message* msg, T* obj, | 155 static bool Dispatch(const Message* msg, T* obj, S* sender, |
154 void (T::*func)(const Message&) const) { | 156 void (T::*func)(const Message&) const) { |
155 (obj->*func)(*msg); | 157 (obj->*func)(*msg); |
156 return true; | 158 return true; |
157 } | 159 } |
158 | 160 |
159 // Used for async messages with no parameters. | 161 // Used for async messages with no parameters. |
160 static void Log(std::string* name, const Message* msg, std::string* l) { | 162 static void Log(std::string* name, const Message* msg, std::string* l) { |
161 } | 163 } |
162 | 164 |
163 // Find the end of the message data that starts at range_start. Returns NULL | 165 // Find the end of the message data that starts at range_start. Returns NULL |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 MSG_ROUTING_NONE = -2, | 274 MSG_ROUTING_NONE = -2, |
273 | 275 |
274 // indicates a general message not sent to a particular tab. | 276 // indicates a general message not sent to a particular tab. |
275 MSG_ROUTING_CONTROL = kint32max, | 277 MSG_ROUTING_CONTROL = kint32max, |
276 }; | 278 }; |
277 | 279 |
278 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies | 280 #define IPC_REPLY_ID 0xFFFFFFF0 // Special message id for replies |
279 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging | 281 #define IPC_LOGGING_ID 0xFFFFFFF1 // Special message id for logging |
280 | 282 |
281 #endif // IPC_IPC_MESSAGE_H__ | 283 #endif // IPC_IPC_MESSAGE_H__ |
OLD | NEW |