| 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 DebuggerEvent; | 14 class Array; |
| 15 class Field; | 15 class Field; |
| 16 class Array; | |
| 17 class GrowableObjectArray; | 16 class GrowableObjectArray; |
| 18 class Instance; | 17 class Instance; |
| 19 class JSONArray; | 18 class JSONArray; |
| 20 class JSONObject; | 19 class JSONObject; |
| 20 class Metric; |
| 21 class Object; | 21 class Object; |
| 22 class ServiceEvent; |
| 22 class SourceBreakpoint; | 23 class SourceBreakpoint; |
| 23 class String; | 24 class String; |
| 24 class Metric; | |
| 25 class Zone; | 25 class Zone; |
| 26 | 26 |
| 27 class JSONStream : ValueObject { | 27 class JSONStream : ValueObject { |
| 28 public: | 28 public: |
| 29 explicit JSONStream(intptr_t buf_size = 256); | 29 explicit JSONStream(intptr_t buf_size = 256); |
| 30 ~JSONStream(); | 30 ~JSONStream(); |
| 31 | 31 |
| 32 void Setup(Zone* zone, | 32 void Setup(Zone* zone, |
| 33 Dart_Port reply_port, | 33 Dart_Port reply_port, |
| 34 const String& method, | 34 const String& method, |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 void PrintValueBool(bool b); | 79 void PrintValueBool(bool b); |
| 80 void PrintValue(intptr_t i); | 80 void PrintValue(intptr_t i); |
| 81 void PrintValue64(int64_t i); | 81 void PrintValue64(int64_t i); |
| 82 void PrintValue(double d); | 82 void PrintValue(double d); |
| 83 void PrintValue(const char* s); | 83 void PrintValue(const char* s); |
| 84 void PrintValue(const char* s, intptr_t len); | 84 void PrintValue(const char* s, intptr_t len); |
| 85 void PrintValueNoEscape(const char* s); | 85 void PrintValueNoEscape(const char* s); |
| 86 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 86 void PrintfValue(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
| 87 void PrintValue(const Object& o, bool ref = true); | 87 void PrintValue(const Object& o, bool ref = true); |
| 88 void PrintValue(SourceBreakpoint* bpt); | 88 void PrintValue(SourceBreakpoint* bpt); |
| 89 void PrintValue(const DebuggerEvent* event); | 89 void PrintValue(const ServiceEvent* event); |
| 90 void PrintValue(Metric* metric); | 90 void PrintValue(Metric* metric); |
| 91 void PrintValue(Isolate* isolate, bool ref = true); | 91 void PrintValue(Isolate* isolate, bool ref = true); |
| 92 bool PrintValueStr(const String& s, intptr_t limit); | 92 bool PrintValueStr(const String& s, intptr_t limit); |
| 93 | 93 |
| 94 void PrintPropertyBool(const char* name, bool b); | 94 void PrintPropertyBool(const char* name, bool b); |
| 95 void PrintProperty(const char* name, intptr_t i); | 95 void PrintProperty(const char* name, intptr_t i); |
| 96 void PrintProperty64(const char* name, int64_t i); | 96 void PrintProperty64(const char* name, int64_t i); |
| 97 void PrintProperty(const char* name, double d); | 97 void PrintProperty(const char* name, double d); |
| 98 void PrintProperty(const char* name, const char* s); | 98 void PrintProperty(const char* name, const char* s); |
| 99 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); | 99 bool PrintPropertyStr(const char* name, const String& s, intptr_t limit); |
| 100 void PrintPropertyNoEscape(const char* name, const char* s); | 100 void PrintPropertyNoEscape(const char* name, const char* s); |
| 101 void PrintfProperty(const char* name, const char* format, ...) | 101 void PrintfProperty(const char* name, const char* format, ...) |
| 102 PRINTF_ATTRIBUTE(3, 4); | 102 PRINTF_ATTRIBUTE(3, 4); |
| 103 void PrintProperty(const char* name, const Object& o, bool ref = true); | 103 void PrintProperty(const char* name, const Object& o, bool ref = true); |
| 104 | 104 |
| 105 void PrintProperty(const char* name, const DebuggerEvent* event); | 105 void PrintProperty(const char* name, const ServiceEvent* event); |
| 106 void PrintProperty(const char* name, SourceBreakpoint* bpt); | 106 void PrintProperty(const char* name, SourceBreakpoint* bpt); |
| 107 void PrintProperty(const char* name, Metric* metric); | 107 void PrintProperty(const char* name, Metric* metric); |
| 108 void PrintProperty(const char* name, Isolate* isolate); | 108 void PrintProperty(const char* name, Isolate* isolate); |
| 109 void PrintPropertyName(const char* name); | 109 void PrintPropertyName(const char* name); |
| 110 void PrintCommaIfNeeded(); | 110 void PrintCommaIfNeeded(); |
| 111 bool NeedComma(); | 111 bool NeedComma(); |
| 112 | 112 |
| 113 bool AddDartString(const String& s, intptr_t limit); | 113 bool AddDartString(const String& s, intptr_t limit); |
| 114 void AddEscapedUTF8String(const char* s); | 114 void AddEscapedUTF8String(const char* s); |
| 115 void AddEscapedUTF8String(const char* s, intptr_t len); | 115 void AddEscapedUTF8String(const char* s, intptr_t len); |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 const String& s, | 163 const String& s, |
| 164 intptr_t limit = -1) const { | 164 intptr_t limit = -1) const { |
| 165 return stream_->PrintPropertyStr(name, s, limit); | 165 return stream_->PrintPropertyStr(name, s, limit); |
| 166 } | 166 } |
| 167 void AddPropertyNoEscape(const char* name, const char* s) const { | 167 void AddPropertyNoEscape(const char* name, const char* s) const { |
| 168 stream_->PrintPropertyNoEscape(name, s); | 168 stream_->PrintPropertyNoEscape(name, s); |
| 169 } | 169 } |
| 170 void AddProperty(const char* name, const Object& obj, bool ref = true) const { | 170 void AddProperty(const char* name, const Object& obj, bool ref = true) const { |
| 171 stream_->PrintProperty(name, obj, ref); | 171 stream_->PrintProperty(name, obj, ref); |
| 172 } | 172 } |
| 173 void AddProperty(const char* name, const DebuggerEvent* event) const { | 173 void AddProperty(const char* name, const ServiceEvent* event) const { |
| 174 stream_->PrintProperty(name, event); | 174 stream_->PrintProperty(name, event); |
| 175 } | 175 } |
| 176 void AddProperty(const char* name, SourceBreakpoint* bpt) const { | 176 void AddProperty(const char* name, SourceBreakpoint* bpt) const { |
| 177 stream_->PrintProperty(name, bpt); | 177 stream_->PrintProperty(name, bpt); |
| 178 } | 178 } |
| 179 void AddProperty(const char* name, Metric* metric) const { | 179 void AddProperty(const char* name, Metric* metric) const { |
| 180 stream_->PrintProperty(name, metric); | 180 stream_->PrintProperty(name, metric); |
| 181 } | 181 } |
| 182 void AddProperty(const char* name, Isolate* isolate) const { | 182 void AddProperty(const char* name, Isolate* isolate) const { |
| 183 stream_->PrintProperty(name, isolate); | 183 stream_->PrintProperty(name, isolate); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 void AddValue(const char* s) const { stream_->PrintValue(s); } | 217 void AddValue(const char* s) const { stream_->PrintValue(s); } |
| 218 void AddValue(const Object& obj, bool ref = true) const { | 218 void AddValue(const Object& obj, bool ref = true) const { |
| 219 stream_->PrintValue(obj, ref); | 219 stream_->PrintValue(obj, ref); |
| 220 } | 220 } |
| 221 void AddValue(Isolate* isolate, bool ref = true) const { | 221 void AddValue(Isolate* isolate, bool ref = true) const { |
| 222 stream_->PrintValue(isolate, ref); | 222 stream_->PrintValue(isolate, ref); |
| 223 } | 223 } |
| 224 void AddValue(SourceBreakpoint* bpt) const { | 224 void AddValue(SourceBreakpoint* bpt) const { |
| 225 stream_->PrintValue(bpt); | 225 stream_->PrintValue(bpt); |
| 226 } | 226 } |
| 227 void AddValue(const DebuggerEvent* event) const { | 227 void AddValue(const ServiceEvent* event) const { |
| 228 stream_->PrintValue(event); | 228 stream_->PrintValue(event); |
| 229 } | 229 } |
| 230 void AddValue(Metric* metric) const { | 230 void AddValue(Metric* metric) const { |
| 231 stream_->PrintValue(metric); | 231 stream_->PrintValue(metric); |
| 232 } | 232 } |
| 233 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); | 233 void AddValueF(const char* format, ...) const PRINTF_ATTRIBUTE(2, 3); |
| 234 | 234 |
| 235 private: | 235 private: |
| 236 JSONStream* stream_; | 236 JSONStream* stream_; |
| 237 | 237 |
| 238 friend class JSONObject; | 238 friend class JSONObject; |
| 239 | 239 |
| 240 DISALLOW_ALLOCATION(); | 240 DISALLOW_ALLOCATION(); |
| 241 DISALLOW_COPY_AND_ASSIGN(JSONArray); | 241 DISALLOW_COPY_AND_ASSIGN(JSONArray); |
| 242 }; | 242 }; |
| 243 | 243 |
| 244 } // namespace dart | 244 } // namespace dart |
| 245 | 245 |
| 246 #endif // VM_JSON_STREAM_H_ | 246 #endif // VM_JSON_STREAM_H_ |
| OLD | NEW |