Chromium Code Reviews| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 return false; | 357 return false; |
| 358 r->insert(item); | 358 r->insert(item); |
| 359 } | 359 } |
| 360 return true; | 360 return true; |
| 361 } | 361 } |
| 362 static void Log(const param_type& p, std::string* l) { | 362 static void Log(const param_type& p, std::string* l) { |
| 363 l->append("<std::set>"); | 363 l->append("<std::set>"); |
| 364 } | 364 } |
| 365 }; | 365 }; |
| 366 | 366 |
| 367 template <class K, class V> | 367 template <class K, class V, class C> |
|
Tom Sepez
2014/09/23 18:01:03
while we're at it, do we want to add a 4th paramet
jkarlin
2014/09/23 18:35:48
Done.
| |
| 368 struct ParamTraits<std::map<K, V> > { | 368 struct ParamTraits<std::map<K, V, C> > { |
| 369 typedef std::map<K, V> param_type; | 369 typedef std::map<K, V, C> param_type; |
| 370 static void Write(Message* m, const param_type& p) { | 370 static void Write(Message* m, const param_type& p) { |
| 371 WriteParam(m, static_cast<int>(p.size())); | 371 WriteParam(m, static_cast<int>(p.size())); |
| 372 typename param_type::const_iterator iter; | 372 typename param_type::const_iterator iter; |
| 373 for (iter = p.begin(); iter != p.end(); ++iter) { | 373 for (iter = p.begin(); iter != p.end(); ++iter) { |
| 374 WriteParam(m, iter->first); | 374 WriteParam(m, iter->first); |
| 375 WriteParam(m, iter->second); | 375 WriteParam(m, iter->second); |
| 376 } | 376 } |
| 377 } | 377 } |
| 378 static bool Read(const Message* m, PickleIterator* iter, | 378 static bool Read(const Message* m, PickleIterator* iter, |
| 379 param_type* r) { | 379 param_type* r) { |
| (...skipping 569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 949 template<typename TA, typename TB, typename TC, typename TD, typename TE> | 949 template<typename TA, typename TB, typename TC, typename TD, typename TE> |
| 950 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { | 950 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { |
| 951 ReplyParam p(a, b, c, d, e); | 951 ReplyParam p(a, b, c, d, e); |
| 952 WriteParam(reply, p); | 952 WriteParam(reply, p); |
| 953 } | 953 } |
| 954 }; | 954 }; |
| 955 | 955 |
| 956 } // namespace IPC | 956 } // namespace IPC |
| 957 | 957 |
| 958 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 958 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
| OLD | NEW |