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

Side by Side Diff: dbus/values_util.cc

Issue 2816513002: Revert of Change base::Value::ListStorage to std::vector<base::Value> (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 #include "dbus/values_util.h" 5 #include "dbus/values_util.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/json/json_writer.h" 9 #include "base/json/json_writer.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 } 275 }
276 writer->CloseContainer(&array_writer); 276 writer->CloseContainer(&array_writer);
277 break; 277 break;
278 } 278 }
279 case base::Value::Type::LIST: { 279 case base::Value::Type::LIST: {
280 const base::ListValue* list = NULL; 280 const base::ListValue* list = NULL;
281 value.GetAsList(&list); 281 value.GetAsList(&list);
282 dbus::MessageWriter array_writer(NULL); 282 dbus::MessageWriter array_writer(NULL);
283 writer->OpenArray("v", &array_writer); 283 writer->OpenArray("v", &array_writer);
284 for (const auto& value : *list) { 284 for (const auto& value : *list) {
285 AppendValueDataAsVariant(&array_writer, value); 285 AppendValueDataAsVariant(&array_writer, *value);
286 } 286 }
287 writer->CloseContainer(&array_writer); 287 writer->CloseContainer(&array_writer);
288 break; 288 break;
289 } 289 }
290 case base::Value::Type::BOOLEAN: 290 case base::Value::Type::BOOLEAN:
291 case base::Value::Type::INTEGER: 291 case base::Value::Type::INTEGER:
292 case base::Value::Type::DOUBLE: 292 case base::Value::Type::DOUBLE:
293 case base::Value::Type::STRING: 293 case base::Value::Type::STRING:
294 AppendBasicTypeValueData(writer, value); 294 AppendBasicTypeValueData(writer, value);
295 break; 295 break;
296 default: 296 default:
297 DLOG(ERROR) << "Unexpected type: " << value.GetType(); 297 DLOG(ERROR) << "Unexpected type: " << value.GetType();
298 } 298 }
299 } 299 }
300 300
301 void AppendValueDataAsVariant(MessageWriter* writer, const base::Value& value) { 301 void AppendValueDataAsVariant(MessageWriter* writer, const base::Value& value) {
302 MessageWriter variant_writer(NULL); 302 MessageWriter variant_writer(NULL);
303 writer->OpenVariant(GetTypeSignature(value), &variant_writer); 303 writer->OpenVariant(GetTypeSignature(value), &variant_writer);
304 AppendValueData(&variant_writer, value); 304 AppendValueData(&variant_writer, value);
305 writer->CloseContainer(&variant_writer); 305 writer->CloseContainer(&variant_writer);
306 } 306 }
307 307
308 } // namespace dbus 308 } // namespace dbus
OLDNEW
« no previous file with comments | « content/test/fuzzer/renderer_tree_fuzzer.cc ('k') | extensions/browser/api/declarative/declarative_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698