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 CHROME_COMMON_IPC_MESSAGE_UTILS_H_ | 5 #ifndef CHROME_COMMON_IPC_MESSAGE_UTILS_H_ |
6 #define CHROME_COMMON_IPC_MESSAGE_UTILS_H_ | 6 #define CHROME_COMMON_IPC_MESSAGE_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 #include <map> | 10 #include <map> |
(...skipping 1124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 LogParam(p.b, l); | 1135 LogParam(p.b, l); |
1136 l->append(L", "); | 1136 l->append(L", "); |
1137 LogParam(p.c, l); | 1137 LogParam(p.c, l); |
1138 l->append(L", "); | 1138 l->append(L", "); |
1139 LogParam(p.d, l); | 1139 LogParam(p.d, l); |
1140 l->append(L", "); | 1140 l->append(L", "); |
1141 LogParam(p.e, l); | 1141 LogParam(p.e, l); |
1142 } | 1142 } |
1143 }; | 1143 }; |
1144 | 1144 |
1145 template <class A, class B, class C, class D, class E, class F> | |
1146 struct ParamTraits< Tuple6<A, B, C, D, E, F> > { | |
1147 typedef Tuple6<A, B, C, D, E, F> param_type; | |
1148 static void Write(Message* m, const param_type& p) { | |
1149 WriteParam(m, p.a); | |
1150 WriteParam(m, p.b); | |
1151 WriteParam(m, p.c); | |
1152 WriteParam(m, p.d); | |
1153 WriteParam(m, p.e); | |
1154 WriteParam(m, p.f); | |
1155 } | |
1156 static bool Read(const Message* m, void** iter, param_type* r) { | |
1157 return (ReadParam(m, iter, &r->a) && | |
1158 ReadParam(m, iter, &r->b) && | |
1159 ReadParam(m, iter, &r->c) && | |
1160 ReadParam(m, iter, &r->d) && | |
1161 ReadParam(m, iter, &r->e) && | |
1162 ReadParam(m, iter, &r->f)); | |
1163 } | |
1164 static void Log(const param_type& p, std::wstring* l) { | |
1165 LogParam(p.a, l); | |
1166 l->append(L", "); | |
1167 LogParam(p.b, l); | |
1168 l->append(L", "); | |
1169 LogParam(p.c, l); | |
1170 l->append(L", "); | |
1171 LogParam(p.d, l); | |
1172 l->append(L", "); | |
1173 LogParam(p.e, l); | |
1174 l->append(L", "); | |
1175 LogParam(p.f, l); | |
1176 } | |
1177 }; | |
1178 | |
1179 template <class A, class B, class C, class D, class E, class F, class G> | |
1180 struct ParamTraits< Tuple7<A, B, C, D, E, F, G> > { | |
1181 typedef Tuple7<A, B, C, D, E, F, G> param_type; | |
1182 static void Write(Message* m, const param_type& p) { | |
1183 WriteParam(m, p.a); | |
1184 WriteParam(m, p.b); | |
1185 WriteParam(m, p.c); | |
1186 WriteParam(m, p.d); | |
1187 WriteParam(m, p.e); | |
1188 WriteParam(m, p.f); | |
1189 WriteParam(m, p.g); | |
1190 } | |
1191 static bool Read(const Message* m, void** iter, param_type* r) { | |
1192 return (ReadParam(m, iter, &r->a) && | |
1193 ReadParam(m, iter, &r->b) && | |
1194 ReadParam(m, iter, &r->c) && | |
1195 ReadParam(m, iter, &r->d) && | |
1196 ReadParam(m, iter, &r->e) && | |
1197 ReadParam(m, iter, &r->f) && | |
1198 ReadParam(m, iter, &r->g)); | |
1199 } | |
1200 static void Log(const param_type& p, std::wstring* l) { | |
1201 LogParam(p.a, l); | |
1202 l->append(L", "); | |
1203 LogParam(p.b, l); | |
1204 l->append(L", "); | |
1205 LogParam(p.c, l); | |
1206 l->append(L", "); | |
1207 LogParam(p.d, l); | |
1208 l->append(L", "); | |
1209 LogParam(p.e, l); | |
1210 l->append(L", "); | |
1211 LogParam(p.f, l); | |
1212 l->append(L", "); | |
1213 LogParam(p.g, l); | |
1214 } | |
1215 }; | |
1216 | |
1217 | |
1218 | |
1219 //----------------------------------------------------------------------------- | 1145 //----------------------------------------------------------------------------- |
1220 // Generic message subclasses | 1146 // Generic message subclasses |
1221 | 1147 |
1222 // Used for asynchronous messages. | 1148 // Used for asynchronous messages. |
1223 template <class ParamType> | 1149 template <class ParamType> |
1224 class MessageWithTuple : public Message { | 1150 class MessageWithTuple : public Message { |
1225 public: | 1151 public: |
1226 typedef ParamType Param; | 1152 typedef ParamType Param; |
1227 typedef typename ParamType::ParamTuple RefParam; | 1153 typedef typename ParamType::ParamTuple RefParam; |
1228 | 1154 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1509 ReplyParam p(a, b, c, d, e); | 1435 ReplyParam p(a, b, c, d, e); |
1510 WriteParam(reply, p); | 1436 WriteParam(reply, p); |
1511 } | 1437 } |
1512 }; | 1438 }; |
1513 | 1439 |
1514 //----------------------------------------------------------------------------- | 1440 //----------------------------------------------------------------------------- |
1515 | 1441 |
1516 } // namespace IPC | 1442 } // namespace IPC |
1517 | 1443 |
1518 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ | 1444 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ |
OLD | NEW |