Chromium Code Reviews| Index: runtime/vm/object.cc |
| diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc |
| index dc5bbbe689c02fdbb5d9b4cc52c066445500a1f5..5f320810fc7a4eb3ca266dcb4eb01838526a85e2 100644 |
| --- a/runtime/vm/object.cc |
| +++ b/runtime/vm/object.cc |
| @@ -20105,7 +20105,24 @@ const char* TypedData::ToCString() const { |
| void TypedData::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| - Instance::PrintJSONImpl(stream, ref); |
| + JSONObject jsobj(stream); |
| + PrintSharedInstanceJSON(&jsobj, ref); |
| + jsobj.AddProperty("kind", "TypedData"); |
| + jsobj.AddServiceId(*this); |
| + jsobj.AddProperty("length", Length()); |
| + jsobj.AddProperty("elementType", ElementTypeName()); |
|
rmacnak
2015/06/05 20:32:35
This feels a bit leaky.
Cutch
2015/06/05 21:00:29
Let's drop elementType and use use the real list t
rmacnak
2015/06/08 22:12:03
Using UserVisibleName
|
| + if (ref) { |
| + return; |
| + } |
| + |
| + { |
| + JSONArray jsarr(&jsobj, "bytes"); |
| + for (intptr_t index = 0; index < LengthInBytes(); index++) { |
| + NoSafepointScope no_safepoint; |
| + uint8_t byte = *reinterpret_cast<uint8_t*>(DataAddr(index)); |
| + jsarr.AddValue(byte); |
|
rmacnak
2015/06/05 20:32:35
base64 would be denser, but is less convenient to
Cutch
2015/06/05 21:00:29
We should use base64.
rmacnak
2015/06/08 22:12:03
Done.
|
| + } |
| + } |
| } |
| @@ -20140,7 +20157,24 @@ const char* ExternalTypedData::ToCString() const { |
| void ExternalTypedData::PrintJSONImpl(JSONStream* stream, |
| bool ref) const { |
| - Instance::PrintJSONImpl(stream, ref); |
| + JSONObject jsobj(stream); |
| + PrintSharedInstanceJSON(&jsobj, ref); |
| + jsobj.AddProperty("kind", "TypedData"); |
| + jsobj.AddServiceId(*this); |
| + jsobj.AddProperty("length", Length()); |
| + jsobj.AddProperty("elementType", ElementTypeName()); |
| + if (ref) { |
| + return; |
| + } |
| + |
| + { |
| + JSONArray jsarr(&jsobj, "bytes"); |
| + for (intptr_t index = 0; index < LengthInBytes(); index++) { |
| + NoSafepointScope no_safepoint; |
| + uint8_t byte = *reinterpret_cast<uint8_t*>(DataAddr(index)); |
| + jsarr.AddValue(byte); |
| + } |
| + } |
| } |