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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 void PrintValue(const char* s, intptr_t len); | 123 void PrintValue(const char* s, intptr_t len); |
122 void PrintValueNoEscape(const char* s); | 124 void PrintValueNoEscape(const char* s); |
123 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 125 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
124 void PrintValue(const Object& o, bool ref = true); | 126 void PrintValue(const Object& o, bool ref = true); |
125 void PrintValue(Breakpoint* bpt); | 127 void PrintValue(Breakpoint* bpt); |
126 void PrintValue(const ServiceEvent* event); | 128 void PrintValue(const ServiceEvent* event); |
127 void PrintValue(Metric* metric); | 129 void PrintValue(Metric* metric); |
128 void PrintValue(MessageQueue* queue); | 130 void PrintValue(MessageQueue* queue); |
129 void PrintValue(Isolate* isolate, bool ref = true); | 131 void PrintValue(Isolate* isolate, bool ref = true); |
130 bool PrintValueStr(const String& s, intptr_t limit); | 132 bool PrintValueStr(const String& s, intptr_t limit); |
| 133 void PrintValue(TimelineEvent* timeline_event); |
131 | 134 |
132 void PrintServiceId(const Object& o); | 135 void PrintServiceId(const Object& o); |
133 void PrintPropertyBool(const char* name, bool b); | 136 void PrintPropertyBool(const char* name, bool b); |
134 void PrintProperty(const char* name, intptr_t i); | 137 void PrintProperty(const char* name, intptr_t i); |
135 void PrintProperty64(const char* name, int64_t i); | 138 void PrintProperty64(const char* name, int64_t i); |
136 void PrintProperty(const char* name, double d); | 139 void PrintProperty(const char* name, double d); |
137 void PrintPropertyBase64(const char* name, | 140 void PrintPropertyBase64(const char* name, |
138 const uint8_t* bytes, | 141 const uint8_t* bytes, |
139 intptr_t length); | 142 intptr_t length); |
140 void PrintProperty(const char* name, const char* s); | 143 void PrintProperty(const char* name, const char* s); |
141 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); | 144 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); |
142 void PrintPropertyNoEscape(const char* name, const char* s); | 145 void PrintPropertyNoEscape(const char* name, const char* s); |
143 void PrintfProperty(const char* name, const char* format, ...) | 146 void PrintfProperty(const char* name, const char* format, ...) |
144 PRINTF_ATTRIBUTE(3, 4); | 147 PRINTF_ATTRIBUTE(3, 4); |
145 void PrintProperty(const char* name, const Object& o, bool ref = true); | 148 void PrintProperty(const char* name, const Object& o, bool ref = true); |
146 | 149 |
147 void PrintProperty(const char* name, const ServiceEvent* event); | 150 void PrintProperty(const char* name, const ServiceEvent* event); |
148 void PrintProperty(const char* name, Breakpoint* bpt); | 151 void PrintProperty(const char* name, Breakpoint* bpt); |
149 void PrintProperty(const char* name, Metric* metric); | 152 void PrintProperty(const char* name, Metric* metric); |
150 void PrintProperty(const char* name, MessageQueue* queue); | 153 void PrintProperty(const char* name, MessageQueue* queue); |
151 void PrintProperty(const char* name, Isolate* isolate); | 154 void PrintProperty(const char* name, Isolate* isolate); |
| 155 void PrintProperty(const char* name, TimelineEvent* timeline_event); |
152 void PrintPropertyName(const char* name); | 156 void PrintPropertyName(const char* name); |
153 void PrintCommaIfNeeded(); | 157 void PrintCommaIfNeeded(); |
154 bool NeedComma(); | 158 bool NeedComma(); |
155 | 159 |
156 bool AddDartString(const String& s, intptr_t limit); | 160 bool AddDartString(const String& s, intptr_t limit); |
157 void AddEscapedUTF8String(const char* s); | 161 void AddEscapedUTF8String(const char* s); |
158 void AddEscapedUTF8String(const char* s, intptr_t len); | 162 void AddEscapedUTF8String(const char* s, intptr_t len); |
159 | 163 |
160 intptr_t nesting_level() const { return open_objects_; } | 164 intptr_t nesting_level() const { return open_objects_; } |
161 | 165 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 } | 244 } |
241 void AddProperty(const char* name, Metric* metric) const { | 245 void AddProperty(const char* name, Metric* metric) const { |
242 stream_->PrintProperty(name, metric); | 246 stream_->PrintProperty(name, metric); |
243 } | 247 } |
244 void AddProperty(const char* name, MessageQueue* queue) const { | 248 void AddProperty(const char* name, MessageQueue* queue) const { |
245 stream_->PrintProperty(name, queue); | 249 stream_->PrintProperty(name, queue); |
246 } | 250 } |
247 void AddProperty(const char* name, Isolate* isolate) const { | 251 void AddProperty(const char* name, Isolate* isolate) const { |
248 stream_->PrintProperty(name, isolate); | 252 stream_->PrintProperty(name, isolate); |
249 } | 253 } |
| 254 void AddProperty(const char* name, TimelineEvent* timeline_event) const { |
| 255 stream_->PrintProperty(name, timeline_event); |
| 256 } |
250 void AddPropertyF(const char* name, const char* format, ...) const | 257 void AddPropertyF(const char* name, const char* format, ...) const |
251 PRINTF_ATTRIBUTE(3, 4); | 258 PRINTF_ATTRIBUTE(3, 4); |
252 | 259 |
253 private: | 260 private: |
254 JSONStream* stream_; | 261 JSONStream* stream_; |
255 | 262 |
256 friend class JSONArray; | 263 friend class JSONArray; |
257 | 264 |
258 DISALLOW_ALLOCATION(); | 265 DISALLOW_ALLOCATION(); |
259 DISALLOW_COPY_AND_ASSIGN(JSONObject); | 266 DISALLOW_COPY_AND_ASSIGN(JSONObject); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 } | 298 } |
292 void AddValue(const ServiceEvent* event) const { | 299 void AddValue(const ServiceEvent* event) const { |
293 stream_->PrintValue(event); | 300 stream_->PrintValue(event); |
294 } | 301 } |
295 void AddValue(Metric* metric) const { | 302 void AddValue(Metric* metric) const { |
296 stream_->PrintValue(metric); | 303 stream_->PrintValue(metric); |
297 } | 304 } |
298 void AddValue(MessageQueue* queue) const { | 305 void AddValue(MessageQueue* queue) const { |
299 stream_->PrintValue(queue); | 306 stream_->PrintValue(queue); |
300 } | 307 } |
| 308 void AddValue(TimelineEvent* timeline_event) const { |
| 309 stream_->PrintValue(timeline_event); |
| 310 } |
301 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 311 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
302 | 312 |
303 private: | 313 private: |
304 JSONStream* stream_; | 314 JSONStream* stream_; |
305 | 315 |
306 friend class JSONObject; | 316 friend class JSONObject; |
307 | 317 |
308 DISALLOW_ALLOCATION(); | 318 DISALLOW_ALLOCATION(); |
309 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 319 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
310 }; | 320 }; |
311 | 321 |
312 } // namespace dart | 322 } // namespace dart |
313 | 323 |
314 #endif // VM_JSON_STREAM_H_ | 324 #endif // VM_JSON_STREAM_H_ |
OLD | NEW |