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

Side by Side Diff: base/json/json_string_value_serializer.cc

Issue 1131113004: Convert JsonWriter::Write to taking a const ref for the in-param (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: another rebase Created 5 years, 7 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 "base/json/json_string_value_serializer.h" 5 #include "base/json/json_string_value_serializer.h"
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 19 matching lines...) Expand all
30 bool omit_binary_values) { 30 bool omit_binary_values) {
31 if (!json_string_) 31 if (!json_string_)
32 return false; 32 return false;
33 33
34 int options = 0; 34 int options = 0;
35 if (omit_binary_values) 35 if (omit_binary_values)
36 options |= base::JSONWriter::OPTIONS_OMIT_BINARY_VALUES; 36 options |= base::JSONWriter::OPTIONS_OMIT_BINARY_VALUES;
37 if (pretty_print_) 37 if (pretty_print_)
38 options |= base::JSONWriter::OPTIONS_PRETTY_PRINT; 38 options |= base::JSONWriter::OPTIONS_PRETTY_PRINT;
39 39
40 return base::JSONWriter::WriteWithOptions(&root, options, json_string_); 40 return base::JSONWriter::WriteWithOptions(root, options, json_string_);
41 } 41 }
42 42
43 JSONStringValueDeserializer::JSONStringValueDeserializer( 43 JSONStringValueDeserializer::JSONStringValueDeserializer(
44 const base::StringPiece& json_string) 44 const base::StringPiece& json_string)
45 : json_string_(json_string), 45 : json_string_(json_string),
46 allow_trailing_comma_(false) { 46 allow_trailing_comma_(false) {
47 } 47 }
48 48
49 JSONStringValueDeserializer::~JSONStringValueDeserializer() {} 49 JSONStringValueDeserializer::~JSONStringValueDeserializer() {}
50 50
51 Value* JSONStringValueDeserializer::Deserialize(int* error_code, 51 Value* JSONStringValueDeserializer::Deserialize(int* error_code,
52 std::string* error_str) { 52 std::string* error_str) {
53 return base::JSONReader::ReadAndReturnError(json_string_, 53 return base::JSONReader::ReadAndReturnError(json_string_,
54 allow_trailing_comma_ ? base::JSON_ALLOW_TRAILING_COMMAS : 54 allow_trailing_comma_ ? base::JSON_ALLOW_TRAILING_COMMAS :
55 base::JSON_PARSE_RFC, 55 base::JSON_PARSE_RFC,
56 error_code, error_str); 56 error_code, error_str);
57 } 57 }
OLDNEW
« no previous file with comments | « android_webview/browser/aw_dev_tools_discovery_provider.cc ('k') | base/json/json_value_serializer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698