Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "vm/object.h" | 5 #include "vm/object.h" |
| 6 | 6 |
| 7 #include "include/dart_api.h" | 7 #include "include/dart_api.h" |
| 8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
| 9 #include "vm/assembler.h" | 9 #include "vm/assembler.h" |
| 10 #include "vm/cpu.h" | 10 #include "vm/cpu.h" |
| (...skipping 20087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20098 return array.raw(); | 20098 return array.raw(); |
| 20099 } | 20099 } |
| 20100 | 20100 |
| 20101 | 20101 |
| 20102 const char* TypedData::ToCString() const { | 20102 const char* TypedData::ToCString() const { |
| 20103 return "TypedData"; | 20103 return "TypedData"; |
| 20104 } | 20104 } |
| 20105 | 20105 |
| 20106 | 20106 |
| 20107 void TypedData::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20107 void TypedData::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20108 Instance::PrintJSONImpl(stream, ref); | 20108 JSONObject jsobj(stream); |
| 20109 PrintSharedInstanceJSON(&jsobj, ref); | |
| 20110 jsobj.AddProperty("kind", "TypedData"); | |
| 20111 jsobj.AddServiceId(*this); | |
| 20112 jsobj.AddProperty("length", Length()); | |
| 20113 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
| |
| 20114 if (ref) { | |
| 20115 return; | |
| 20116 } | |
| 20117 | |
| 20118 { | |
| 20119 JSONArray jsarr(&jsobj, "bytes"); | |
| 20120 for (intptr_t index = 0; index < LengthInBytes(); index++) { | |
| 20121 NoSafepointScope no_safepoint; | |
| 20122 uint8_t byte = *reinterpret_cast<uint8_t*>(DataAddr(index)); | |
| 20123 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.
| |
| 20124 } | |
| 20125 } | |
| 20109 } | 20126 } |
| 20110 | 20127 |
| 20111 | 20128 |
| 20112 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( | 20129 FinalizablePersistentHandle* ExternalTypedData::AddFinalizer( |
| 20113 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { | 20130 void* peer, Dart_WeakPersistentHandleFinalizer callback) const { |
| 20114 return dart::AddFinalizer(*this, peer, callback); | 20131 return dart::AddFinalizer(*this, peer, callback); |
| 20115 } | 20132 } |
| 20116 | 20133 |
| 20117 | 20134 |
| 20118 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, | 20135 RawExternalTypedData* ExternalTypedData::New(intptr_t class_id, |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 20133 } | 20150 } |
| 20134 | 20151 |
| 20135 | 20152 |
| 20136 const char* ExternalTypedData::ToCString() const { | 20153 const char* ExternalTypedData::ToCString() const { |
| 20137 return "ExternalTypedData"; | 20154 return "ExternalTypedData"; |
| 20138 } | 20155 } |
| 20139 | 20156 |
| 20140 | 20157 |
| 20141 void ExternalTypedData::PrintJSONImpl(JSONStream* stream, | 20158 void ExternalTypedData::PrintJSONImpl(JSONStream* stream, |
| 20142 bool ref) const { | 20159 bool ref) const { |
| 20143 Instance::PrintJSONImpl(stream, ref); | 20160 JSONObject jsobj(stream); |
| 20161 PrintSharedInstanceJSON(&jsobj, ref); | |
| 20162 jsobj.AddProperty("kind", "TypedData"); | |
| 20163 jsobj.AddServiceId(*this); | |
| 20164 jsobj.AddProperty("length", Length()); | |
| 20165 jsobj.AddProperty("elementType", ElementTypeName()); | |
| 20166 if (ref) { | |
| 20167 return; | |
| 20168 } | |
| 20169 | |
| 20170 { | |
| 20171 JSONArray jsarr(&jsobj, "bytes"); | |
| 20172 for (intptr_t index = 0; index < LengthInBytes(); index++) { | |
| 20173 NoSafepointScope no_safepoint; | |
| 20174 uint8_t byte = *reinterpret_cast<uint8_t*>(DataAddr(index)); | |
| 20175 jsarr.AddValue(byte); | |
| 20176 } | |
| 20177 } | |
| 20144 } | 20178 } |
| 20145 | 20179 |
| 20146 | 20180 |
| 20147 RawCapability* Capability::New(uint64_t id, Heap::Space space) { | 20181 RawCapability* Capability::New(uint64_t id, Heap::Space space) { |
| 20148 Capability& result = Capability::Handle(); | 20182 Capability& result = Capability::Handle(); |
| 20149 { | 20183 { |
| 20150 RawObject* raw = Object::Allocate(Capability::kClassId, | 20184 RawObject* raw = Object::Allocate(Capability::kClassId, |
| 20151 Capability::InstanceSize(), | 20185 Capability::InstanceSize(), |
| 20152 space); | 20186 space); |
| 20153 NoSafepointScope no_safepoint; | 20187 NoSafepointScope no_safepoint; |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 20810 return tag_label.ToCString(); | 20844 return tag_label.ToCString(); |
| 20811 } | 20845 } |
| 20812 | 20846 |
| 20813 | 20847 |
| 20814 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { | 20848 void UserTag::PrintJSONImpl(JSONStream* stream, bool ref) const { |
| 20815 Instance::PrintJSONImpl(stream, ref); | 20849 Instance::PrintJSONImpl(stream, ref); |
| 20816 } | 20850 } |
| 20817 | 20851 |
| 20818 | 20852 |
| 20819 } // namespace dart | 20853 } // namespace dart |
| OLD | NEW |