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 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 | 31 |
32 JSONStream::~JSONStream() { | 32 JSONStream::~JSONStream() { |
33 } | 33 } |
34 | 34 |
35 | 35 |
36 void JSONStream::Setup(Zone* zone, | 36 void JSONStream::Setup(Zone* zone, |
37 Dart_Port reply_port, | 37 Dart_Port reply_port, |
38 const GrowableObjectArray& path, | 38 const GrowableObjectArray& path, |
39 const GrowableObjectArray& option_keys, | 39 const Array& option_keys, |
40 const GrowableObjectArray& option_values) { | 40 const Array& option_values) { |
41 set_reply_port(reply_port); | 41 set_reply_port(reply_port); |
42 | 42 |
43 // Setup JSONStream arguments and options. The arguments and options | 43 // Setup JSONStream arguments and options. The arguments and options |
44 // are zone allocated and will be freed immediately after handling the | 44 // are zone allocated and will be freed immediately after handling the |
45 // message. | 45 // message. |
46 const char** arguments = zone->Alloc<const char*>(path.Length()); | 46 const char** arguments = zone->Alloc<const char*>(path.Length()); |
47 String& string_iterator = String::Handle(); | 47 String& string_iterator = String::Handle(); |
48 for (intptr_t i = 0; i < path.Length(); i++) { | 48 for (intptr_t i = 0; i < path.Length(); i++) { |
49 string_iterator ^= path.At(i); | 49 string_iterator ^= path.At(i); |
50 arguments[i] = zone->MakeCopyOfString(string_iterator.ToCString()); | 50 arguments[i] = zone->MakeCopyOfString(string_iterator.ToCString()); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 429 intptr_t len2 = OS::VSNPrint(p, len+1, format, args); |
430 va_end(args); | 430 va_end(args); |
431 ASSERT(len == len2); | 431 ASSERT(len == len2); |
432 stream_->buffer_.AddChar('"'); | 432 stream_->buffer_.AddChar('"'); |
433 stream_->AddEscapedUTF8String(p); | 433 stream_->AddEscapedUTF8String(p); |
434 stream_->buffer_.AddChar('"'); | 434 stream_->buffer_.AddChar('"'); |
435 free(p); | 435 free(p); |
436 } | 436 } |
437 | 437 |
438 } // namespace dart | 438 } // namespace dart |
OLD | NEW |