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 | 11 |
12 namespace dart { | 12 namespace dart { |
13 | 13 |
14 class Array; | 14 class Array; |
15 class Field; | 15 class Field; |
16 class GrowableObjectArray; | 16 class GrowableObjectArray; |
17 class Instance; | 17 class Instance; |
18 class JSONArray; | 18 class JSONArray; |
19 class JSONObject; | 19 class JSONObject; |
| 20 class MessageQueue; |
20 class Metric; | 21 class Metric; |
21 class Object; | 22 class Object; |
22 class ServiceEvent; | 23 class ServiceEvent; |
23 class SourceBreakpoint; | 24 class SourceBreakpoint; |
24 class String; | 25 class String; |
25 class Zone; | 26 class Zone; |
26 | 27 |
27 class JSONStream : ValueObject { | 28 class JSONStream : ValueObject { |
28 public: | 29 public: |
29 explicit JSONStream(intptr_t buf_size = 256); | 30 explicit JSONStream(intptr_t buf_size = 256); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 void PrintValue64(int64_t i); | 85 void PrintValue64(int64_t i); |
85 void PrintValue(double d); | 86 void PrintValue(double d); |
86 void PrintValue(const char* s); | 87 void PrintValue(const char* s); |
87 void PrintValue(const char* s, intptr_t len); | 88 void PrintValue(const char* s, intptr_t len); |
88 void PrintValueNoEscape(const char* s); | 89 void PrintValueNoEscape(const char* s); |
89 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 90 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
90 void PrintValue(const Object& o, bool ref = true); | 91 void PrintValue(const Object& o, bool ref = true); |
91 void PrintValue(SourceBreakpoint* bpt); | 92 void PrintValue(SourceBreakpoint* bpt); |
92 void PrintValue(const ServiceEvent* event); | 93 void PrintValue(const ServiceEvent* event); |
93 void PrintValue(Metric* metric); | 94 void PrintValue(Metric* metric); |
| 95 void PrintValue(MessageQueue* queue); |
94 void PrintValue(Isolate* isolate, bool ref = true); | 96 void PrintValue(Isolate* isolate, bool ref = true); |
95 bool PrintValueStr(const String& s, intptr_t limit); | 97 bool PrintValueStr(const String& s, intptr_t limit); |
96 | 98 |
97 void PrintPropertyBool(const char* name, bool b); | 99 void PrintPropertyBool(const char* name, bool b); |
98 void PrintProperty(const char* name, intptr_t i); | 100 void PrintProperty(const char* name, intptr_t i); |
99 void PrintProperty64(const char* name, int64_t i); | 101 void PrintProperty64(const char* name, int64_t i); |
100 void PrintProperty(const char* name, double d); | 102 void PrintProperty(const char* name, double d); |
101 void PrintProperty(const char* name, const char* s); | 103 void PrintProperty(const char* name, const char* s); |
102 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); | 104 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); |
103 void PrintPropertyNoEscape(const char* name, const char* s); | 105 void PrintPropertyNoEscape(const char* name, const char* s); |
104 void PrintfProperty(const char* name, const char* format, ...) | 106 void PrintfProperty(const char* name, const char* format, ...) |
105 PRINTF_ATTRIBUTE(3, 4); | 107 PRINTF_ATTRIBUTE(3, 4); |
106 void PrintProperty(const char* name, const Object& o, bool ref = true); | 108 void PrintProperty(const char* name, const Object& o, bool ref = true); |
107 | 109 |
108 void PrintProperty(const char* name, const ServiceEvent* event); | 110 void PrintProperty(const char* name, const ServiceEvent* event); |
109 void PrintProperty(const char* name, SourceBreakpoint* bpt); | 111 void PrintProperty(const char* name, SourceBreakpoint* bpt); |
110 void PrintProperty(const char* name, Metric* metric); | 112 void PrintProperty(const char* name, Metric* metric); |
| 113 void PrintProperty(const char* name, MessageQueue* queue); |
111 void PrintProperty(const char* name, Isolate* isolate); | 114 void PrintProperty(const char* name, Isolate* isolate); |
112 void PrintPropertyName(const char* name); | 115 void PrintPropertyName(const char* name); |
113 void PrintCommaIfNeeded(); | 116 void PrintCommaIfNeeded(); |
114 bool NeedComma(); | 117 bool NeedComma(); |
115 | 118 |
116 bool AddDartString(const String& s, intptr_t limit); | 119 bool AddDartString(const String& s, intptr_t limit); |
117 void AddEscapedUTF8String(const char* s); | 120 void AddEscapedUTF8String(const char* s); |
118 void AddEscapedUTF8String(const char* s, intptr_t len); | 121 void AddEscapedUTF8String(const char* s, intptr_t len); |
119 | 122 |
120 intptr_t nesting_level() const { return open_objects_; } | 123 intptr_t nesting_level() const { return open_objects_; } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 } | 179 } |
177 void AddProperty(const char* name, const ServiceEvent* event) const { | 180 void AddProperty(const char* name, const ServiceEvent* event) const { |
178 stream_->PrintProperty(name, event); | 181 stream_->PrintProperty(name, event); |
179 } | 182 } |
180 void AddProperty(const char* name, SourceBreakpoint* bpt) const { | 183 void AddProperty(const char* name, SourceBreakpoint* bpt) const { |
181 stream_->PrintProperty(name, bpt); | 184 stream_->PrintProperty(name, bpt); |
182 } | 185 } |
183 void AddProperty(const char* name, Metric* metric) const { | 186 void AddProperty(const char* name, Metric* metric) const { |
184 stream_->PrintProperty(name, metric); | 187 stream_->PrintProperty(name, metric); |
185 } | 188 } |
| 189 void AddProperty(const char* name, MessageQueue* queue) const { |
| 190 stream_->PrintProperty(name, queue); |
| 191 } |
186 void AddProperty(const char* name, Isolate* isolate) const { | 192 void AddProperty(const char* name, Isolate* isolate) const { |
187 stream_->PrintProperty(name, isolate); | 193 stream_->PrintProperty(name, isolate); |
188 } | 194 } |
189 void AddPropertyF(const char* name, const char* format, ...) const | 195 void AddPropertyF(const char* name, const char* format, ...) const |
190 PRINTF_ATTRIBUTE(3, 4); | 196 PRINTF_ATTRIBUTE(3, 4); |
191 | 197 |
192 private: | 198 private: |
193 JSONStream* stream_; | 199 JSONStream* stream_; |
194 | 200 |
195 friend class JSONArray; | 201 friend class JSONArray; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 } | 233 } |
228 void AddValue(SourceBreakpoint* bpt) const { | 234 void AddValue(SourceBreakpoint* bpt) const { |
229 stream_->PrintValue(bpt); | 235 stream_->PrintValue(bpt); |
230 } | 236 } |
231 void AddValue(const ServiceEvent* event) const { | 237 void AddValue(const ServiceEvent* event) const { |
232 stream_->PrintValue(event); | 238 stream_->PrintValue(event); |
233 } | 239 } |
234 void AddValue(Metric* metric) const { | 240 void AddValue(Metric* metric) const { |
235 stream_->PrintValue(metric); | 241 stream_->PrintValue(metric); |
236 } | 242 } |
| 243 void AddValue(MessageQueue* queue) const { |
| 244 stream_->PrintValue(queue); |
| 245 } |
237 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 246 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
238 | 247 |
239 private: | 248 private: |
240 JSONStream* stream_; | 249 JSONStream* stream_; |
241 | 250 |
242 friend class JSONObject; | 251 friend class JSONObject; |
243 | 252 |
244 DISALLOW_ALLOCATION(); | 253 DISALLOW_ALLOCATION(); |
245 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 254 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
246 }; | 255 }; |
247 | 256 |
248 } // namespace dart | 257 } // namespace dart |
249 | 258 |
250 #endif // VM_JSON_STREAM_H_ | 259 #endif // VM_JSON_STREAM_H_ |
OLD | NEW |