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

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

Issue 12910004: base: Move many JSONValueSerializer unit tests from chrome/common to base. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « base/json/json_value_serializer_unittest.cc ('k') | base/json/string_escape.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_writer.h" 5 #include "base/json/json_writer.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/json/string_escape.h" 9 #include "base/json/string_escape.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stringprintf.h" 11 #include "base/stringprintf.h"
12 #include "base/strings/string_number_conversions.h" 12 #include "base/strings/string_number_conversions.h"
13 #include "base/utf_string_conversions.h"
13 #include "base/values.h" 14 #include "base/values.h"
14 #include "base/utf_string_conversions.h"
15 15
16 namespace base { 16 namespace base {
17 17
18 #if defined(OS_WIN) 18 #if defined(OS_WIN)
19 static const char kPrettyPrintLineEnding[] = "\r\n"; 19 static const char kPrettyPrintLineEnding[] = "\r\n";
20 #else 20 #else
21 static const char kPrettyPrintLineEnding[] = "\n"; 21 static const char kPrettyPrintLineEnding[] = "\n";
22 #endif 22 #endif
23 23
24 /* static */ 24 /* static */
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 JsonDoubleQuote(UTF8ToUTF16(str), true, json_string_); 224 JsonDoubleQuote(UTF8ToUTF16(str), true, json_string_);
225 } 225 }
226 226
227 void JSONWriter::IndentLine(int depth) { 227 void JSONWriter::IndentLine(int depth) {
228 // It may be faster to keep an indent string so we don't have to keep 228 // It may be faster to keep an indent string so we don't have to keep
229 // reallocating. 229 // reallocating.
230 json_string_->append(std::string(depth * 3, ' ')); 230 json_string_->append(std::string(depth * 3, ' '));
231 } 231 }
232 232
233 } // namespace base 233 } // namespace base
OLDNEW
« no previous file with comments | « base/json/json_value_serializer_unittest.cc ('k') | base/json/string_escape.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698