Chromium Code Reviews| Index: runtime/vm/json_stream.cc |
| diff --git a/runtime/vm/json_stream.cc b/runtime/vm/json_stream.cc |
| index d72ff5bd765090a135348fd253d7c6b2b676e414..4247a574dbdca2be24e58bcec600b9434d51e43c 100644 |
| --- a/runtime/vm/json_stream.cc |
| +++ b/runtime/vm/json_stream.cc |
| @@ -8,6 +8,7 @@ |
| #include "vm/debugger.h" |
| #include "vm/json_stream.h" |
| #include "vm/message.h" |
| +#include "vm/metrics.h" |
| #include "vm/object.h" |
| #include "vm/unicode.h" |
| @@ -259,6 +260,12 @@ void JSONStream::PrintValue(const DebuggerEvent* event) { |
| } |
| +void JSONStream::PrintValue(VMMetric* metric) { |
| + PrintCommaIfNeeded(); |
| + metric->PrintJSON(this); |
| +} |
| + |
| + |
| void JSONStream::PrintValue(Isolate* isolate, bool ref) { |
| PrintCommaIfNeeded(); |
| isolate->PrintJSON(this, ref); |
| @@ -313,6 +320,11 @@ void JSONStream::PrintProperty(const char* name, SourceBreakpoint* bpt) { |
| } |
| +void JSONStream::PrintProperty(const char* name, VMMetric* metric) { |
| + PrintPropertyName(name); |
| + PrintValue(metric); |
| +} |
| + |
| void JSONStream::PrintProperty(const char* name, Isolate* isolate) { |
| PrintPropertyName(name); |
| PrintValue(isolate); |
| @@ -396,6 +408,9 @@ bool JSONStream::NeedComma() { |
| void JSONStream::AddEscapedUTF8String(const char* s) { |
| + if (s == NULL) { |
|
koda
2014/08/12 22:03:03
Do we really want to silently accept this? I fear
Cutch
2014/08/13 17:50:59
If someone calls:
AddProperty("key", value);
whe
koda
2014/08/13 22:42:59
I meant that NULL is often used to indicate an (un
Cutch
2014/08/14 20:56:18
Acknowledged.
|
| + return; |
| + } |
| intptr_t len = strlen(s); |
| const uint8_t* s8 = reinterpret_cast<const uint8_t*>(s); |
| intptr_t i = 0; |