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 #include "ipc/ipc_message_utils.h" | 5 #include "ipc/ipc_message_utils.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); | 119 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); |
120 it.Advance()) { | 120 it.Advance()) { |
121 GetParamSize(sizer, it.key()); | 121 GetParamSize(sizer, it.key()); |
122 GetValueSize(sizer, &it.value(), recursion + 1); | 122 GetValueSize(sizer, &it.value(), recursion + 1); |
123 } | 123 } |
124 break; | 124 break; |
125 } | 125 } |
126 case base::Value::TYPE_LIST: { | 126 case base::Value::TYPE_LIST: { |
127 sizer->AddInt(); | 127 sizer->AddInt(); |
128 const base::ListValue* list = static_cast<const base::ListValue*>(value); | 128 const base::ListValue* list = static_cast<const base::ListValue*>(value); |
129 for (base::ListValue::const_iterator it = list->begin(); | 129 for (const auto& entry : *list) { |
130 it != list->end(); ++it) { | 130 GetValueSize(sizer, entry.get(), recursion + 1); |
131 GetValueSize(sizer, *it, recursion + 1); | |
132 } | 131 } |
133 break; | 132 break; |
134 } | 133 } |
135 default: | 134 default: |
136 NOTREACHED() << "Invalid base::Value type."; | 135 NOTREACHED() << "Invalid base::Value type."; |
137 } | 136 } |
138 } | 137 } |
139 | 138 |
140 void WriteValue(base::Pickle* m, const base::Value* value, int recursion) { | 139 void WriteValue(base::Pickle* m, const base::Value* value, int recursion) { |
141 bool result; | 140 bool result; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); | 191 for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); |
193 it.Advance()) { | 192 it.Advance()) { |
194 WriteParam(m, it.key()); | 193 WriteParam(m, it.key()); |
195 WriteValue(m, &it.value(), recursion + 1); | 194 WriteValue(m, &it.value(), recursion + 1); |
196 } | 195 } |
197 break; | 196 break; |
198 } | 197 } |
199 case base::Value::TYPE_LIST: { | 198 case base::Value::TYPE_LIST: { |
200 const base::ListValue* list = static_cast<const base::ListValue*>(value); | 199 const base::ListValue* list = static_cast<const base::ListValue*>(value); |
201 WriteParam(m, static_cast<int>(list->GetSize())); | 200 WriteParam(m, static_cast<int>(list->GetSize())); |
202 for (base::ListValue::const_iterator it = list->begin(); | 201 for (const auto& entry : *list) { |
203 it != list->end(); ++it) { | 202 WriteValue(m, entry.get(), recursion + 1); |
204 WriteValue(m, *it, recursion + 1); | |
205 } | 203 } |
206 break; | 204 break; |
207 } | 205 } |
208 } | 206 } |
209 } | 207 } |
210 | 208 |
211 // Helper for ReadValue that reads a DictionaryValue into a pre-allocated | 209 // Helper for ReadValue that reads a DictionaryValue into a pre-allocated |
212 // object. | 210 // object. |
213 bool ReadDictionaryValue(const base::Pickle* m, | 211 bool ReadDictionaryValue(const base::Pickle* m, |
214 base::PickleIterator* iter, | 212 base::PickleIterator* iter, |
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1205 return result; | 1203 return result; |
1206 } | 1204 } |
1207 | 1205 |
1208 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { | 1206 void ParamTraits<MSG>::Log(const param_type& p, std::string* l) { |
1209 l->append("<MSG>"); | 1207 l->append("<MSG>"); |
1210 } | 1208 } |
1211 | 1209 |
1212 #endif // OS_WIN | 1210 #endif // OS_WIN |
1213 | 1211 |
1214 } // namespace IPC | 1212 } // namespace IPC |
OLD | NEW |