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_IPC_MESSAGE_UTILS_H_ | 5 #ifndef IPC_IPC_MESSAGE_UTILS_H_ |
6 #define IPC_IPC_MESSAGE_UTILS_H_ | 6 #define IPC_IPC_MESSAGE_UTILS_H_ |
7 | 7 |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 static void Write(Message* m, const param_type& p) { | 154 static void Write(Message* m, const param_type& p) { |
155 m->WriteInt(p); | 155 m->WriteInt(p); |
156 } | 156 } |
157 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { | 157 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { |
158 return m->ReadInt(iter, reinterpret_cast<int*>(r)); | 158 return m->ReadInt(iter, reinterpret_cast<int*>(r)); |
159 } | 159 } |
160 IPC_EXPORT static void Log(const param_type& p, std::string* l); | 160 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
161 }; | 161 }; |
162 | 162 |
163 template <> | 163 template <> |
| 164 struct ParamTraits<void*> { |
| 165 typedef void* param_type; |
| 166 static void Write(Message* m, const param_type& p) { |
| 167 m->WriteLongUsingDangerousNonPortableLessPersistableForm( |
| 168 reinterpret_cast<long>(p)); |
| 169 } |
| 170 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { |
| 171 long p = 0; |
| 172 bool ret = m->ReadLong(iter, &p); |
| 173 *r = reinterpret_cast<void*>(p); |
| 174 return ret; |
| 175 } |
| 176 IPC_EXPORT static void Log(const param_type& p, std::string* l) {} |
| 177 }; |
| 178 |
| 179 template <> |
164 struct ParamTraits<long> { | 180 struct ParamTraits<long> { |
165 typedef long param_type; | 181 typedef long param_type; |
166 static void Write(Message* m, const param_type& p) { | 182 static void Write(Message* m, const param_type& p) { |
167 m->WriteLongUsingDangerousNonPortableLessPersistableForm(p); | 183 m->WriteLongUsingDangerousNonPortableLessPersistableForm(p); |
168 } | 184 } |
169 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { | 185 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { |
170 return m->ReadLong(iter, r); | 186 return m->ReadLong(iter, r); |
171 } | 187 } |
172 IPC_EXPORT static void Log(const param_type& p, std::string* l); | 188 IPC_EXPORT static void Log(const param_type& p, std::string* l); |
173 }; | 189 }; |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 template<typename TA, typename TB, typename TC, typename TD, typename TE> | 894 template<typename TA, typename TB, typename TC, typename TD, typename TE> |
879 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { | 895 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { |
880 ReplyParam p(a, b, c, d, e); | 896 ReplyParam p(a, b, c, d, e); |
881 WriteParam(reply, p); | 897 WriteParam(reply, p); |
882 } | 898 } |
883 }; | 899 }; |
884 | 900 |
885 } // namespace IPC | 901 } // namespace IPC |
886 | 902 |
887 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 903 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
OLD | NEW |