OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/assert.h" | 5 #include "platform/assert.h" |
6 | 6 |
7 #include "vm/dart_entry.h" | 7 #include "vm/dart_entry.h" |
8 #include "vm/debugger.h" | 8 #include "vm/debugger.h" |
9 #include "vm/json_stream.h" | 9 #include "vm/json_stream.h" |
10 #include "vm/message.h" | 10 #include "vm/message.h" |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
527 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 527 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
528 va_end(args); | 528 va_end(args); |
529 ASSERT(len == len2); | 529 ASSERT(len == len2); |
530 buffer_.AddChar('"'); | 530 buffer_.AddChar('"'); |
531 AddEscapedUTF8String(p); | 531 AddEscapedUTF8String(p); |
532 buffer_.AddChar('"'); | 532 buffer_.AddChar('"'); |
533 free(p); | 533 free(p); |
534 } | 534 } |
535 | 535 |
536 | 536 |
| 537 void JSONStream::Steal(const char** buffer, intptr_t* buffer_length) { |
| 538 ASSERT(buffer != NULL); |
| 539 ASSERT(buffer_length != NULL); |
| 540 *buffer_length = buffer_.length(); |
| 541 *buffer = buffer_.Steal(); |
| 542 } |
| 543 |
| 544 |
537 void JSONStream::set_reply_port(Dart_Port port) { | 545 void JSONStream::set_reply_port(Dart_Port port) { |
538 reply_port_ = port; | 546 reply_port_ = port; |
539 } | 547 } |
540 | 548 |
541 | 549 |
542 void JSONStream::SetParams(const char** param_keys, | 550 void JSONStream::SetParams(const char** param_keys, |
543 const char** param_values, | 551 const char** param_values, |
544 intptr_t num_params) { | 552 intptr_t num_params) { |
545 param_keys_ = param_keys; | 553 param_keys_ = param_keys; |
546 param_values_ = param_values; | 554 param_values_ = param_values; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 708 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
701 va_end(args); | 709 va_end(args); |
702 ASSERT(len == len2); | 710 ASSERT(len == len2); |
703 stream_->buffer_.AddChar('"'); | 711 stream_->buffer_.AddChar('"'); |
704 stream_->AddEscapedUTF8String(p); | 712 stream_->AddEscapedUTF8String(p); |
705 stream_->buffer_.AddChar('"'); | 713 stream_->buffer_.AddChar('"'); |
706 free(p); | 714 free(p); |
707 } | 715 } |
708 | 716 |
709 } // namespace dart | 717 } // namespace dart |
OLD | NEW |