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 <limits.h> | 8 #include <limits.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
672 typedef base::UnguessableToken param_type; | 672 typedef base::UnguessableToken param_type; |
673 static void GetSize(base::PickleSizer* sizer, const param_type& p); | 673 static void GetSize(base::PickleSizer* sizer, const param_type& p); |
674 static void Write(base::Pickle* m, const param_type& p); | 674 static void Write(base::Pickle* m, const param_type& p); |
675 static bool Read(const base::Pickle* m, | 675 static bool Read(const base::Pickle* m, |
676 base::PickleIterator* iter, | 676 base::PickleIterator* iter, |
677 param_type* r); | 677 param_type* r); |
678 static void Log(const param_type& p, std::string* l); | 678 static void Log(const param_type& p, std::string* l); |
679 }; | 679 }; |
680 | 680 |
681 template <> | 681 template <> |
682 struct IPC_EXPORT ParamTraits<std::unique_ptr<base::Value>> { | |
683 typedef std::unique_ptr<base::Value> param_type; | |
684 static void GetSize(base::PickleSizer* sizer, const param_type& p); | |
685 static void Write(base::Pickle* m, const param_type& p); | |
686 static bool Read(const base::Pickle* m, | |
687 base::PickleIterator* iter, | |
688 param_type* r); | |
689 static void Log(const param_type& p, std::string* l); | |
690 }; | |
691 | |
692 template <> | |
682 struct ParamTraits<std::tuple<>> { | 693 struct ParamTraits<std::tuple<>> { |
683 typedef std::tuple<> param_type; | 694 typedef std::tuple<> param_type; |
684 static void GetSize(base::PickleSizer* sizer, const param_type& p) {} | 695 static void GetSize(base::PickleSizer* sizer, const param_type& p) {} |
685 static void Write(base::Pickle* m, const param_type& p) {} | 696 static void Write(base::Pickle* m, const param_type& p) {} |
686 static bool Read(const base::Pickle* m, | 697 static bool Read(const base::Pickle* m, |
687 base::PickleIterator* iter, | 698 base::PickleIterator* iter, |
688 param_type* r) { | 699 param_type* r) { |
689 return true; | 700 return true; |
690 } | 701 } |
691 static void Log(const param_type& p, std::string* l) { | 702 static void Log(const param_type& p, std::string* l) { |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
948 if (!ReadParam(m, iter, &value)) | 959 if (!ReadParam(m, iter, &value)) |
949 return false; | 960 return false; |
950 } | 961 } |
951 return true; | 962 return true; |
952 } | 963 } |
953 static void Log(const param_type& p, std::string* l) { | 964 static void Log(const param_type& p, std::string* l) { |
954 l->append("<base::SmallMap>"); | 965 l->append("<base::SmallMap>"); |
955 } | 966 } |
956 }; | 967 }; |
957 | 968 |
958 template <class P> | 969 template <class P> |
Tom Sepez
2016/11/03 20:54:50
Wondering why this partial specialization doesn't
| |
959 struct ParamTraits<std::unique_ptr<P>> { | 970 struct ParamTraits<std::unique_ptr<P>> { |
960 typedef std::unique_ptr<P> param_type; | 971 typedef std::unique_ptr<P> param_type; |
961 static void GetSize(base::PickleSizer* sizer, const param_type& p) { | 972 static void GetSize(base::PickleSizer* sizer, const param_type& p) { |
962 bool valid = !!p; | 973 bool valid = !!p; |
963 GetParamSize(sizer, valid); | 974 GetParamSize(sizer, valid); |
964 if (valid) | 975 if (valid) |
965 GetParamSize(sizer, *p); | 976 GetParamSize(sizer, *p); |
966 } | 977 } |
967 static void Write(base::Pickle* m, const param_type& p) { | 978 static void Write(base::Pickle* m, const param_type& p) { |
968 bool valid = !!p; | 979 bool valid = !!p; |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1152 template <class ReplyParamType> | 1163 template <class ReplyParamType> |
1153 inline void LogReplyParamsToMessage(const ReplyParamType& reply_params, | 1164 inline void LogReplyParamsToMessage(const ReplyParamType& reply_params, |
1154 const Message* msg) {} | 1165 const Message* msg) {} |
1155 | 1166 |
1156 inline void ConnectMessageAndReply(const Message* msg, Message* reply) {} | 1167 inline void ConnectMessageAndReply(const Message* msg, Message* reply) {} |
1157 #endif | 1168 #endif |
1158 | 1169 |
1159 } // namespace IPC | 1170 } // namespace IPC |
1160 | 1171 |
1161 #endif // IPC_IPC_MESSAGE_UTILS_H_ | 1172 #endif // IPC_IPC_MESSAGE_UTILS_H_ |
OLD | NEW |