| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 LogParam(p.b, l); | 632 LogParam(p.b, l); |
| 633 l->append(", "); | 633 l->append(", "); |
| 634 LogParam(p.c, l); | 634 LogParam(p.c, l); |
| 635 l->append(", "); | 635 l->append(", "); |
| 636 LogParam(p.d, l); | 636 LogParam(p.d, l); |
| 637 l->append(", "); | 637 l->append(", "); |
| 638 LogParam(p.e, l); | 638 LogParam(p.e, l); |
| 639 } | 639 } |
| 640 }; | 640 }; |
| 641 | 641 |
| 642 template <class A, class B, class C, class D, class E, class F> |
| 643 struct ParamTraits< Tuple6<A, B, C, D, E, F> > { |
| 644 typedef Tuple6<A, B, C, D, E, F> param_type; |
| 645 static void Write(Message* m, const param_type& p) { |
| 646 WriteParam(m, p.a); |
| 647 WriteParam(m, p.b); |
| 648 WriteParam(m, p.c); |
| 649 WriteParam(m, p.d); |
| 650 WriteParam(m, p.e); |
| 651 WriteParam(m, p.f); |
| 652 } |
| 653 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { |
| 654 return (ReadParam(m, iter, &r->a) && |
| 655 ReadParam(m, iter, &r->b) && |
| 656 ReadParam(m, iter, &r->c) && |
| 657 ReadParam(m, iter, &r->d) && |
| 658 ReadParam(m, iter, &r->e) && |
| 659 ReadParam(m, iter, &r->f)); |
| 660 } |
| 661 static void Log(const param_type& p, std::string* l) { |
| 662 LogParam(p.a, l); |
| 663 l->append(", "); |
| 664 LogParam(p.b, l); |
| 665 l->append(", "); |
| 666 LogParam(p.c, l); |
| 667 l->append(", "); |
| 668 LogParam(p.d, l); |
| 669 l->append(", "); |
| 670 LogParam(p.e, l); |
| 671 l->append(", "); |
| 672 LogParam(p.f, l); |
| 673 } |
| 674 }; |
| 675 |
| 642 template<class P> | 676 template<class P> |
| 643 struct ParamTraits<ScopedVector<P> > { | 677 struct ParamTraits<ScopedVector<P> > { |
| 644 typedef ScopedVector<P> param_type; | 678 typedef ScopedVector<P> param_type; |
| 645 static void Write(Message* m, const param_type& p) { | 679 static void Write(Message* m, const param_type& p) { |
| 646 WriteParam(m, static_cast<int>(p.size())); | 680 WriteParam(m, static_cast<int>(p.size())); |
| 647 for (size_t i = 0; i < p.size(); i++) | 681 for (size_t i = 0; i < p.size(); i++) |
| 648 WriteParam(m, *p[i]); | 682 WriteParam(m, *p[i]); |
| 649 } | 683 } |
| 650 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { | 684 static bool Read(const Message* m, PickleIterator* iter, param_type* r) { |
| 651 int size = 0; | 685 int size = 0; |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 878 template<typename TA, typename TB, typename TC, typename TD, typename TE> | 912 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) { | 913 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { |
| 880 ReplyParam p(a, b, c, d, e); | 914 ReplyParam p(a, b, c, d, e); |
| 881 WriteParam(reply, p); | 915 WriteParam(reply, p); |
| 882 } | 916 } |
| 883 }; | 917 }; |
| 884 | 918 |
| 885 } // namespace IPC | 919 } // namespace IPC |
| 886 | 920 |
| 887 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 921 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
| OLD | NEW |