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 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
989 static void Write(Message* m, const param_type& p); | 989 static void Write(Message* m, const param_type& p); |
990 static bool Read(const Message* m, void** iter, param_type* r); | 990 static bool Read(const Message* m, void** iter, param_type* r); |
991 static void Log(const param_type& p, std::wstring* l); | 991 static void Log(const param_type& p, std::wstring* l); |
992 }; | 992 }; |
993 | 993 |
994 | 994 |
995 //----------------------------------------------------------------------------- | 995 //----------------------------------------------------------------------------- |
996 // Generic message subclasses | 996 // Generic message subclasses |
997 | 997 |
998 // Used for asynchronous messages. | 998 // Used for asynchronous messages. |
999 template <class Param> | 999 template <class ParamType> |
1000 class MessageWithTuple : public Message { | 1000 class MessageWithTuple : public Message { |
1001 public: | 1001 public: |
| 1002 typedef ParamType Param; |
| 1003 |
1002 MessageWithTuple(int32 routing_id, uint16 type, const Param& p) | 1004 MessageWithTuple(int32 routing_id, uint16 type, const Param& p) |
1003 : Message(routing_id, type, PRIORITY_NORMAL) { | 1005 : Message(routing_id, type, PRIORITY_NORMAL) { |
1004 WriteParam(this, p); | 1006 WriteParam(this, p); |
1005 } | 1007 } |
1006 | 1008 |
1007 static bool Read(const Message* msg, Param* p) { | 1009 static bool Read(const Message* msg, Param* p) { |
1008 void* iter = NULL; | 1010 void* iter = NULL; |
1009 bool rv = ReadParam(msg, &iter, p); | 1011 bool rv = ReadParam(msg, &iter, p); |
1010 DCHECK(rv) << "Error deserializing message " << msg->type(); | 1012 DCHECK(rv) << "Error deserializing message " << msg->type(); |
1011 return rv; | 1013 return rv; |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1254 l->append(L"<FindInPageRequest>"); | 1256 l->append(L"<FindInPageRequest>"); |
1255 } | 1257 } |
1256 }; | 1258 }; |
1257 | 1259 |
1258 //----------------------------------------------------------------------------- | 1260 //----------------------------------------------------------------------------- |
1259 | 1261 |
1260 } // namespace IPC | 1262 } // namespace IPC |
1261 | 1263 |
1262 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ | 1264 #endif // CHROME_COMMON_IPC_MESSAGE_UTILS_H_ |
1263 | 1265 |
OLD | NEW |