| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 if (!msg_.ReadData(&iter_, data, length)) { | 114 if (!msg_.ReadData(&iter_, data, length)) { |
| 115 NOTREACHED(); | 115 NOTREACHED(); |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 private: | 118 private: |
| 119 const Message& msg_; | 119 const Message& msg_; |
| 120 mutable void* iter_; | 120 mutable void* iter_; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 //----------------------------------------------------------------------------- | 123 //----------------------------------------------------------------------------- |
| 124 // A dummy struct to place first just to allow leading commas for all |
| 125 // members in the macro-generated constructor initializer lists. |
| 126 struct NoParams { |
| 127 }; |
| 128 |
| 129 //----------------------------------------------------------------------------- |
| 124 // ParamTraits specializations, etc. | 130 // ParamTraits specializations, etc. |
| 125 | 131 |
| 126 template <class P> | 132 template <class P> |
| 127 static inline void WriteParam(Message* m, const P& p) { | 133 static inline void WriteParam(Message* m, const P& p) { |
| 128 typedef typename SimilarTypeTraits<P>::Type Type; | 134 typedef typename SimilarTypeTraits<P>::Type Type; |
| 129 ParamTraits<Type>::Write(m, static_cast<const Type& >(p)); | 135 ParamTraits<Type>::Write(m, static_cast<const Type& >(p)); |
| 130 } | 136 } |
| 131 | 137 |
| 132 template <class P> | 138 template <class P> |
| 133 static inline bool WARN_UNUSED_RESULT ReadParam(const Message* m, void** iter, | 139 static inline bool WARN_UNUSED_RESULT ReadParam(const Message* m, void** iter, |
| (...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1188 ReplyParam p(a, b, c, d, e); | 1194 ReplyParam p(a, b, c, d, e); |
| 1189 WriteParam(reply, p); | 1195 WriteParam(reply, p); |
| 1190 } | 1196 } |
| 1191 }; | 1197 }; |
| 1192 | 1198 |
| 1193 //----------------------------------------------------------------------------- | 1199 //----------------------------------------------------------------------------- |
| 1194 | 1200 |
| 1195 } // namespace IPC | 1201 } // namespace IPC |
| 1196 | 1202 |
| 1197 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 1203 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
| OLD | NEW |