Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: ipc/ipc_message_utils.h

Issue 2825853002: Improvements to uses of base::SmallMap (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 881 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 l->append(" "); 892 l->append(" ");
893 LogParam((p[i]), l); 893 LogParam((p[i]), l);
894 } 894 }
895 } 895 }
896 }; 896 };
897 897
898 template <typename NormalMap, 898 template <typename NormalMap,
899 int kArraySize, 899 int kArraySize,
900 typename EqualKey, 900 typename EqualKey,
901 typename MapInit> 901 typename MapInit>
902 struct ParamTraits<base::SmallMap<NormalMap, kArraySize, EqualKey, MapInit> > { 902 struct ParamTraits<base::small_map<NormalMap, kArraySize, EqualKey, MapInit>> {
903 typedef base::SmallMap<NormalMap, kArraySize, EqualKey, MapInit> param_type; 903 typedef base::small_map<NormalMap, kArraySize, EqualKey, MapInit> param_type;
danakj 2017/04/18 21:35:50 typedef->using?
904 typedef typename param_type::key_type K; 904 typedef typename param_type::key_type K;
905 typedef typename param_type::data_type V; 905 typedef typename param_type::data_type V;
906 static void GetSize(base::PickleSizer* sizer, const param_type& p) { 906 static void GetSize(base::PickleSizer* sizer, const param_type& p) {
907 GetParamSize(sizer, static_cast<int>(p.size())); 907 GetParamSize(sizer, static_cast<int>(p.size()));
908 typename param_type::const_iterator iter; 908 typename param_type::const_iterator iter;
909 for (iter = p.begin(); iter != p.end(); ++iter) { 909 for (iter = p.begin(); iter != p.end(); ++iter) {
910 GetParamSize(sizer, iter->first); 910 GetParamSize(sizer, iter->first);
911 GetParamSize(sizer, iter->second); 911 GetParamSize(sizer, iter->second);
912 } 912 }
913 } 913 }
(...skipping 15 matching lines...) Expand all
929 K key; 929 K key;
930 if (!ReadParam(m, iter, &key)) 930 if (!ReadParam(m, iter, &key))
931 return false; 931 return false;
932 V& value = (*r)[key]; 932 V& value = (*r)[key];
933 if (!ReadParam(m, iter, &value)) 933 if (!ReadParam(m, iter, &value))
934 return false; 934 return false;
935 } 935 }
936 return true; 936 return true;
937 } 937 }
938 static void Log(const param_type& p, std::string* l) { 938 static void Log(const param_type& p, std::string* l) {
939 l->append("<base::SmallMap>"); 939 l->append("<base::small_map>");
940 } 940 }
941 }; 941 };
942 942
943 template <class P> 943 template <class P>
944 struct ParamTraits<std::unique_ptr<P>> { 944 struct ParamTraits<std::unique_ptr<P>> {
945 typedef std::unique_ptr<P> param_type; 945 typedef std::unique_ptr<P> param_type;
946 static void GetSize(base::PickleSizer* sizer, const param_type& p) { 946 static void GetSize(base::PickleSizer* sizer, const param_type& p) {
947 bool valid = !!p; 947 bool valid = !!p;
948 GetParamSize(sizer, valid); 948 GetParamSize(sizer, valid);
949 if (valid) 949 if (valid)
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 template <class ReplyParamType> 1136 template <class ReplyParamType>
1137 inline void LogReplyParamsToMessage(const ReplyParamType& reply_params, 1137 inline void LogReplyParamsToMessage(const ReplyParamType& reply_params,
1138 const Message* msg) {} 1138 const Message* msg) {}
1139 1139
1140 inline void ConnectMessageAndReply(const Message* msg, Message* reply) {} 1140 inline void ConnectMessageAndReply(const Message* msg, Message* reply) {}
1141 #endif 1141 #endif
1142 1142
1143 } // namespace IPC 1143 } // namespace IPC
1144 1144
1145 #endif // IPC_IPC_MESSAGE_UTILS_H_ 1145 #endif // IPC_IPC_MESSAGE_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698