| Index: runtime/vm/json_stream.cc
|
| diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc
|
| index 06c13fc645efc95043c7a72242c861576ee33a26..f894c712fedc1b5794c33d4624a46cd9df89dd76 100644
|
| --- a/runtime/vm/json_stream.cc
|
| +++ b/runtime/vm/json_stream.cc
|
| @@ -22,6 +22,7 @@ JSONStream::JSONStream(intptr_t buf_size)
|
| : open_objects_(0),
|
| buffer_(buf_size),
|
| reply_port_(ILLEGAL_PORT),
|
| + seq_(""),
|
| method_(""),
|
| param_keys_(NULL),
|
| param_values_(NULL),
|
| @@ -35,10 +36,12 @@ JSONStream::~JSONStream() {
|
|
|
| void JSONStream::Setup(Zone* zone,
|
| Dart_Port reply_port,
|
| + const String& seq,
|
| const String& method,
|
| const Array& param_keys,
|
| const Array& param_values) {
|
| set_reply_port(reply_port);
|
| + seq_ = seq.ToCString();
|
| method_ = method.ToCString();
|
|
|
| String& string_iterator = String::Handle();
|
| @@ -66,6 +69,13 @@ void JSONStream::Setup(Zone* zone,
|
| isolate_name, method_);
|
| setup_time_micros_ = OS::GetCurrentTimeMicros();
|
| }
|
| + buffer_.Printf("{\"result\":");
|
| +}
|
| +
|
| +
|
| +void JSONStream::SetupError() {
|
| + buffer_.Clear();
|
| + buffer_.Printf("{\"error\":");
|
| }
|
|
|
|
|
| @@ -83,6 +93,8 @@ void JSONStream::PostReply() {
|
| if (FLAG_trace_service) {
|
| process_delta_micros = OS::GetCurrentTimeMicros() - setup_time_micros_;
|
| }
|
| + // TODO(turnidge): Handle non-string sequence numbers.
|
| + buffer_.Printf(", \"id\":\"%s\"}", seq());
|
| const String& reply = String::Handle(String::New(ToCString()));
|
| ASSERT(!reply.IsNull());
|
|
|
|
|