| 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" | 
| 11 #include "vm/metrics.h" | 11 #include "vm/metrics.h" | 
| 12 #include "vm/object.h" | 12 #include "vm/object.h" | 
| 13 #include "vm/service_event.h" | 13 #include "vm/service_event.h" | 
|  | 14 #include "vm/service.h" | 
| 14 #include "vm/unicode.h" | 15 #include "vm/unicode.h" | 
| 15 | 16 | 
| 16 | 17 | 
| 17 namespace dart { | 18 namespace dart { | 
| 18 | 19 | 
| 19 DECLARE_FLAG(bool, trace_service); | 20 DECLARE_FLAG(bool, trace_service); | 
| 20 | 21 | 
| 21 JSONStream::JSONStream(intptr_t buf_size) | 22 JSONStream::JSONStream(intptr_t buf_size) | 
| 22     : open_objects_(0), | 23     : open_objects_(0), | 
| 23       buffer_(buf_size), | 24       buffer_(buf_size), | 
|  | 25       default_id_zone_(Isolate::Current()->object_id_ring(), | 
|  | 26                        ObjectIdRing::kAllocateId), | 
|  | 27       id_zone_(&default_id_zone_), | 
| 24       reply_port_(ILLEGAL_PORT), | 28       reply_port_(ILLEGAL_PORT), | 
| 25       seq_(""), | 29       seq_(""), | 
| 26       method_(""), | 30       method_(""), | 
| 27       param_keys_(NULL), | 31       param_keys_(NULL), | 
| 28       param_values_(NULL), | 32       param_values_(NULL), | 
| 29       num_params_(0) { | 33       num_params_(0) { | 
| 30 } | 34 } | 
| 31 | 35 | 
| 32 | 36 | 
| 33 JSONStream::~JSONStream() { | 37 JSONStream::~JSONStream() { | 
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 278   queue->PrintJSON(this); | 282   queue->PrintJSON(this); | 
| 279 } | 283 } | 
| 280 | 284 | 
| 281 | 285 | 
| 282 void JSONStream::PrintValue(Isolate* isolate, bool ref) { | 286 void JSONStream::PrintValue(Isolate* isolate, bool ref) { | 
| 283   PrintCommaIfNeeded(); | 287   PrintCommaIfNeeded(); | 
| 284   isolate->PrintJSON(this, ref); | 288   isolate->PrintJSON(this, ref); | 
| 285 } | 289 } | 
| 286 | 290 | 
| 287 | 291 | 
|  | 292 void JSONStream::PrintServiceId(const char* name, const Object& o) { | 
|  | 293   ASSERT(id_zone_ != NULL); | 
|  | 294   PrintProperty(name, id_zone_->GetServiceId(o)); | 
|  | 295 } | 
|  | 296 | 
|  | 297 | 
| 288 void JSONStream::PrintPropertyBool(const char* name, bool b) { | 298 void JSONStream::PrintPropertyBool(const char* name, bool b) { | 
| 289   PrintPropertyName(name); | 299   PrintPropertyName(name); | 
| 290   PrintValueBool(b); | 300   PrintValueBool(b); | 
| 291 } | 301 } | 
| 292 | 302 | 
| 293 | 303 | 
| 294 void JSONStream::PrintProperty(const char* name, intptr_t i) { | 304 void JSONStream::PrintProperty(const char* name, intptr_t i) { | 
| 295   ASSERT(Utils::IsJavascriptInt(i)); | 305   ASSERT(Utils::IsJavascriptInt(i)); | 
| 296   PrintPropertyName(name); | 306   PrintPropertyName(name); | 
| 297   PrintValue(i); | 307   PrintValue(i); | 
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 510   intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 520   intptr_t len2 = OS::VSNPrint(p, len+1, format, args); | 
| 511   va_end(args); | 521   va_end(args); | 
| 512   ASSERT(len == len2); | 522   ASSERT(len == len2); | 
| 513   stream_->buffer_.AddChar('"'); | 523   stream_->buffer_.AddChar('"'); | 
| 514   stream_->AddEscapedUTF8String(p); | 524   stream_->AddEscapedUTF8String(p); | 
| 515   stream_->buffer_.AddChar('"'); | 525   stream_->buffer_.AddChar('"'); | 
| 516   free(p); | 526   free(p); | 
| 517 } | 527 } | 
| 518 | 528 | 
| 519 }  // namespace dart | 529 }  // namespace dart | 
| OLD | NEW | 
|---|