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

Side by Side Diff: runtime/platform/json.cc

Issue 170943003: Allow for embedder provided service request handlers (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | « runtime/platform/json.h ('k') | runtime/vm/dart_api_impl.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 Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "platform/json.h" 5 #include "platform/json.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "platform/globals.h" 8 #include "platform/globals.h"
9 #include "platform/utils.h" 9 #include "platform/utils.h"
10 #include "vm/os.h" 10 #include "vm/os.h"
(...skipping 492 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 buf_ = NULL; 503 buf_ = NULL;
504 } 504 }
505 505
506 506
507 void TextBuffer::Clear() { 507 void TextBuffer::Clear() {
508 msg_len_ = 0; 508 msg_len_ = 0;
509 buf_[0] = '\0'; 509 buf_[0] = '\0';
510 } 510 }
511 511
512 512
513 const char* TextBuffer::Steal() {
514 const char* r = buf_;
515 buf_ = NULL;
516 buf_size_ = 0;
517 msg_len_ = 0;
518 return r;
519 }
520
521
513 void TextBuffer::AddChar(char ch) { 522 void TextBuffer::AddChar(char ch) {
514 EnsureCapacity(sizeof(ch)); 523 EnsureCapacity(sizeof(ch));
515 buf_[msg_len_] = ch; 524 buf_[msg_len_] = ch;
516 msg_len_++; 525 msg_len_++;
517 buf_[msg_len_] = '\0'; 526 buf_[msg_len_] = '\0';
518 } 527 }
519 528
520 529
521 void TextBuffer::AddUTF8(uint32_t ch) { 530 void TextBuffer::AddUTF8(uint32_t ch) {
522 static const uint32_t kMaxOneByteChar = 0x7F; 531 static const uint32_t kMaxOneByteChar = 0x7F;
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 // the debugger front-end. 652 // the debugger front-end.
644 intptr_t new_size = buf_size_ + len + kBufferSpareCapacity; 653 intptr_t new_size = buf_size_ + len + kBufferSpareCapacity;
645 char* new_buf = reinterpret_cast<char*>(realloc(buf_, new_size)); 654 char* new_buf = reinterpret_cast<char*>(realloc(buf_, new_size));
646 ASSERT(new_buf != NULL); 655 ASSERT(new_buf != NULL);
647 buf_ = new_buf; 656 buf_ = new_buf;
648 buf_size_ = new_size; 657 buf_size_ = new_size;
649 } 658 }
650 } 659 }
651 660
652 } // namespace dart 661 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/platform/json.h ('k') | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698