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

Side by Side Diff: src/string-builder.h

Issue 1922603006: [JSON] implement indentation in the BasicJsonStringifier and expose via API. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 4 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
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/test-api.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project 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 V8_STRING_BUILDER_H_ 5 #ifndef V8_STRING_BUILDER_H_
6 #define V8_STRING_BUILDER_H_ 6 #define V8_STRING_BUILDER_H_
7 7
8 #include "src/assert-scope.h" 8 #include "src/assert-scope.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/handles.h" 10 #include "src/handles.h"
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 INLINE(void AppendCString(const char* s)) { 287 INLINE(void AppendCString(const char* s)) {
288 const uint8_t* u = reinterpret_cast<const uint8_t*>(s); 288 const uint8_t* u = reinterpret_cast<const uint8_t*>(s);
289 if (encoding_ == String::ONE_BYTE_ENCODING) { 289 if (encoding_ == String::ONE_BYTE_ENCODING) {
290 while (*u != '\0') Append<uint8_t, uint8_t>(*(u++)); 290 while (*u != '\0') Append<uint8_t, uint8_t>(*(u++));
291 } else { 291 } else {
292 while (*u != '\0') Append<uint8_t, uc16>(*(u++)); 292 while (*u != '\0') Append<uint8_t, uc16>(*(u++));
293 } 293 }
294 } 294 }
295 295
296 INLINE(void AppendCString(const uc16* s)) {
297 if (encoding_ == String::ONE_BYTE_ENCODING) {
298 while (*s != '\0') Append<uc16, uint8_t>(*(s++));
299 } else {
300 while (*s != '\0') Append<uc16, uc16>(*(s++));
301 }
302 }
303
296 INLINE(bool CurrentPartCanFit(int length)) { 304 INLINE(bool CurrentPartCanFit(int length)) {
297 return part_length_ - current_index_ > length; 305 return part_length_ - current_index_ > length;
298 } 306 }
299 307
300 void AppendString(Handle<String> string); 308 void AppendString(Handle<String> string);
301 309
302 MaybeHandle<String> Finish(); 310 MaybeHandle<String> Finish();
303 311
304 // Change encoding to two-byte. 312 // Change encoding to two-byte.
305 void ChangeEncoding() { 313 void ChangeEncoding() {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding_); 436 DCHECK_EQ(String::TWO_BYTE_ENCODING, encoding_);
429 SeqTwoByteString::cast(*current_part_) 437 SeqTwoByteString::cast(*current_part_)
430 ->SeqTwoByteStringSet(current_index_++, c); 438 ->SeqTwoByteStringSet(current_index_++, c);
431 } 439 }
432 if (current_index_ == part_length_) Extend(); 440 if (current_index_ == part_length_) Extend();
433 } 441 }
434 } // namespace internal 442 } // namespace internal
435 } // namespace v8 443 } // namespace v8
436 444
437 #endif // V8_STRING_BUILDER_H_ 445 #endif // V8_STRING_BUILDER_H_
OLDNEW
« no previous file with comments | « src/runtime/runtime-object.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698