| 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 #ifndef VM_JSON_STREAM_H_ | 5 #ifndef VM_JSON_STREAM_H_ |
| 6 #define VM_JSON_STREAM_H_ | 6 #define VM_JSON_STREAM_H_ |
| 7 | 7 |
| 8 #include "include/dart_api.h" // for Dart_Port | 8 #include "include/dart_api.h" // for Dart_Port |
| 9 #include "platform/json.h" | 9 #include "platform/json.h" |
| 10 #include "vm/allocation.h" | 10 #include "vm/allocation.h" |
| 11 #include "vm/service.h" | 11 #include "vm/service.h" |
| 12 | 12 |
| 13 |
| 13 namespace dart { | 14 namespace dart { |
| 14 | 15 |
| 15 class Array; | 16 class Array; |
| 17 class Breakpoint; |
| 16 class Field; | 18 class Field; |
| 17 class GrowableObjectArray; | 19 class GrowableObjectArray; |
| 18 class Instance; | 20 class Instance; |
| 19 class JSONArray; | 21 class JSONArray; |
| 20 class JSONObject; | 22 class JSONObject; |
| 21 class MessageQueue; | 23 class MessageQueue; |
| 22 class Metric; | 24 class Metric; |
| 23 class Object; | 25 class Object; |
| 24 class Script; | 26 class Script; |
| 25 class ServiceEvent; | 27 class ServiceEvent; |
| 26 class Breakpoint; | |
| 27 class String; | 28 class String; |
| 29 class TimelineEvent; |
| 28 class Zone; | 30 class Zone; |
| 29 | 31 |
| 30 | 32 |
| 31 // Keep this enum in sync with: | 33 // Keep this enum in sync with: |
| 32 // | 34 // |
| 33 // - runtime/vm/service/vmservice.dart | 35 // - runtime/vm/service/vmservice.dart |
| 34 // - runtime/observatory/lib/src/service/object.dart | 36 // - runtime/observatory/lib/src/service/object.dart |
| 35 // | 37 // |
| 36 enum JSONRpcErrorCode { | 38 enum JSONRpcErrorCode { |
| 37 kParseError = -32700, | 39 kParseError = -32700, |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 void PrintValue(const char* s, intptr_t len); | 122 void PrintValue(const char* s, intptr_t len); |
| 121 void PrintValueNoEscape(const char* s); | 123 void PrintValueNoEscape(const char* s); |
| 122 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 124 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 123 void PrintValue(const Object& o, bool ref = true); | 125 void PrintValue(const Object& o, bool ref = true); |
| 124 void PrintValue(Breakpoint* bpt); | 126 void PrintValue(Breakpoint* bpt); |
| 125 void PrintValue(const ServiceEvent* event); | 127 void PrintValue(const ServiceEvent* event); |
| 126 void PrintValue(Metric* metric); | 128 void PrintValue(Metric* metric); |
| 127 void PrintValue(MessageQueue* queue); | 129 void PrintValue(MessageQueue* queue); |
| 128 void PrintValue(Isolate* isolate, bool ref = true); | 130 void PrintValue(Isolate* isolate, bool ref = true); |
| 129 bool PrintValueStr(const String& s, intptr_t limit); | 131 bool PrintValueStr(const String& s, intptr_t limit); |
| 132 void PrintValue(TimelineEvent* timeline_event); |
| 130 | 133 |
| 131 void PrintServiceId(const Object& o); | 134 void PrintServiceId(const Object& o); |
| 132 void PrintPropertyBool(const char* name, bool b); | 135 void PrintPropertyBool(const char* name, bool b); |
| 133 void PrintProperty(const char* name, intptr_t i); | 136 void PrintProperty(const char* name, intptr_t i); |
| 134 void PrintProperty64(const char* name, int64_t i); | 137 void PrintProperty64(const char* name, int64_t i); |
| 135 void PrintProperty(const char* name, double d); | 138 void PrintProperty(const char* name, double d); |
| 136 void PrintProperty(const char* name, const char* s); | 139 void PrintProperty(const char* name, const char* s); |
| 137 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); | 140 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); |
| 138 void PrintPropertyNoEscape(const char* name, const char* s); | 141 void PrintPropertyNoEscape(const char* name, const char* s); |
| 139 void PrintfProperty(const char* name, const char* format, ...) | 142 void PrintfProperty(const char* name, const char* format, ...) |
| 140 PRINTF_ATTRIBUTE(3, 4); | 143 PRINTF_ATTRIBUTE(3, 4); |
| 141 void PrintProperty(const char* name, const Object& o, bool ref = true); | 144 void PrintProperty(const char* name, const Object& o, bool ref = true); |
| 142 | 145 |
| 143 void PrintProperty(const char* name, const ServiceEvent* event); | 146 void PrintProperty(const char* name, const ServiceEvent* event); |
| 144 void PrintProperty(const char* name, Breakpoint* bpt); | 147 void PrintProperty(const char* name, Breakpoint* bpt); |
| 145 void PrintProperty(const char* name, Metric* metric); | 148 void PrintProperty(const char* name, Metric* metric); |
| 146 void PrintProperty(const char* name, MessageQueue* queue); | 149 void PrintProperty(const char* name, MessageQueue* queue); |
| 147 void PrintProperty(const char* name, Isolate* isolate); | 150 void PrintProperty(const char* name, Isolate* isolate); |
| 151 void PrintProperty(const char* name, TimelineEvent* timeline_event); |
| 148 void PrintPropertyName(const char* name); | 152 void PrintPropertyName(const char* name); |
| 149 void PrintCommaIfNeeded(); | 153 void PrintCommaIfNeeded(); |
| 150 bool NeedComma(); | 154 bool NeedComma(); |
| 151 | 155 |
| 152 bool AddDartString(const String& s, intptr_t limit); | 156 bool AddDartString(const String& s, intptr_t limit); |
| 153 void AddEscapedUTF8String(const char* s); | 157 void AddEscapedUTF8String(const char* s); |
| 154 void AddEscapedUTF8String(const char* s, intptr_t len); | 158 void AddEscapedUTF8String(const char* s, intptr_t len); |
| 155 | 159 |
| 156 intptr_t nesting_level() const { return open_objects_; } | 160 intptr_t nesting_level() const { return open_objects_; } |
| 157 | 161 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 235 } |
| 232 void AddProperty(const char* name, Metric* metric) const { | 236 void AddProperty(const char* name, Metric* metric) const { |
| 233 stream_->PrintProperty(name, metric); | 237 stream_->PrintProperty(name, metric); |
| 234 } | 238 } |
| 235 void AddProperty(const char* name, MessageQueue* queue) const { | 239 void AddProperty(const char* name, MessageQueue* queue) const { |
| 236 stream_->PrintProperty(name, queue); | 240 stream_->PrintProperty(name, queue); |
| 237 } | 241 } |
| 238 void AddProperty(const char* name, Isolate* isolate) const { | 242 void AddProperty(const char* name, Isolate* isolate) const { |
| 239 stream_->PrintProperty(name, isolate); | 243 stream_->PrintProperty(name, isolate); |
| 240 } | 244 } |
| 245 void AddProperty(const char* name, TimelineEvent* timeline_event) const { |
| 246 stream_->PrintProperty(name, timeline_event); |
| 247 } |
| 241 void AddPropertyF(const char* name, const char* format, ...) const | 248 void AddPropertyF(const char* name, const char* format, ...) const |
| 242 PRINTF_ATTRIBUTE(3, 4); | 249 PRINTF_ATTRIBUTE(3, 4); |
| 243 | 250 |
| 244 private: | 251 private: |
| 245 JSONStream* stream_; | 252 JSONStream* stream_; |
| 246 | 253 |
| 247 friend class JSONArray; | 254 friend class JSONArray; |
| 248 | 255 |
| 249 DISALLOW_ALLOCATION(); | 256 DISALLOW_ALLOCATION(); |
| 250 DISALLOW_COPY_AND_ASSIGN(JSONObject); | 257 DISALLOW_COPY_AND_ASSIGN(JSONObject); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 } | 289 } |
| 283 void AddValue(const ServiceEvent* event) const { | 290 void AddValue(const ServiceEvent* event) const { |
| 284 stream_->PrintValue(event); | 291 stream_->PrintValue(event); |
| 285 } | 292 } |
| 286 void AddValue(Metric* metric) const { | 293 void AddValue(Metric* metric) const { |
| 287 stream_->PrintValue(metric); | 294 stream_->PrintValue(metric); |
| 288 } | 295 } |
| 289 void AddValue(MessageQueue* queue) const { | 296 void AddValue(MessageQueue* queue) const { |
| 290 stream_->PrintValue(queue); | 297 stream_->PrintValue(queue); |
| 291 } | 298 } |
| 299 void AddValue(TimelineEvent* timeline_event) const { |
| 300 stream_->PrintValue(timeline_event); |
| 301 } |
| 292 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 302 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
| 293 | 303 |
| 294 private: | 304 private: |
| 295 JSONStream* stream_; | 305 JSONStream* stream_; |
| 296 | 306 |
| 297 friend class JSONObject; | 307 friend class JSONObject; |
| 298 | 308 |
| 299 DISALLOW_ALLOCATION(); | 309 DISALLOW_ALLOCATION(); |
| 300 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 310 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
| 301 }; | 311 }; |
| 302 | 312 |
| 303 } // namespace dart | 313 } // namespace dart |
| 304 | 314 |
| 305 #endif // VM_JSON_STREAM_H_ | 315 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |