mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1220918 - Serialize and deseriliaze JS::ubi::Node's script filenames in heap snapshots; r=sfink
This commit is contained in:
parent
984b96cb46
commit
ef4d81b5bd
@ -49,6 +49,8 @@ struct NodeOneofInstance {
|
||||
::google::protobuf::uint64 typenameref_;
|
||||
const ::std::string* jsobjectclassname_;
|
||||
::google::protobuf::uint64 jsobjectclassnameref_;
|
||||
const ::std::string* scriptfilename_;
|
||||
::google::protobuf::uint64 scriptfilenameref_;
|
||||
}* Node_default_oneof_instance_ = NULL;
|
||||
const ::google::protobuf::Descriptor* Edge_descriptor_ = NULL;
|
||||
const ::google::protobuf::internal::GeneratedMessageReflection*
|
||||
@ -130,7 +132,7 @@ void protobuf_AssignDesc_CoreDump_2eproto() {
|
||||
::google::protobuf::MessageFactory::generated_factory(),
|
||||
sizeof(StackFrame_Data));
|
||||
Node_descriptor_ = file->message_type(2);
|
||||
static const int Node_offsets_[11] = {
|
||||
static const int Node_offsets_[14] = {
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Node, id_),
|
||||
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Node_default_oneof_instance_, typename__),
|
||||
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Node_default_oneof_instance_, typenameref_),
|
||||
@ -140,8 +142,11 @@ void protobuf_AssignDesc_CoreDump_2eproto() {
|
||||
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Node_default_oneof_instance_, jsobjectclassname_),
|
||||
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Node_default_oneof_instance_, jsobjectclassnameref_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Node, coarsetype_),
|
||||
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Node_default_oneof_instance_, scriptfilename_),
|
||||
PROTO2_GENERATED_DEFAULT_ONEOF_FIELD_OFFSET(Node_default_oneof_instance_, scriptfilenameref_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Node, TypeNameOrRef_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Node, JSObjectClassNameOrRef_),
|
||||
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(Node, ScriptFilenameOrRef_),
|
||||
};
|
||||
Node_reflection_ =
|
||||
new ::google::protobuf::internal::GeneratedMessageReflection(
|
||||
@ -237,17 +242,19 @@ void protobuf_AddDesc_CoreDump_2eproto() {
|
||||
"nDisplayName\030\007 \001(\014H\001\022 \n\026functionDisplayN"
|
||||
"ameRef\030\010 \001(\004H\001\022\020\n\010isSystem\030\t \001(\010\022\024\n\014isSe"
|
||||
"lfHosted\030\n \001(\010B\r\n\013SourceOrRefB\032\n\030Functio"
|
||||
"nDisplayNameOrRefB\020\n\016StackFrameType\"\272\002\n\004"
|
||||
"nDisplayNameOrRefB\020\n\016StackFrameType\"\210\003\n\004"
|
||||
"Node\022\n\n\002id\030\001 \001(\004\022\022\n\010typeName\030\002 \001(\014H\000\022\025\n\013"
|
||||
"typeNameRef\030\003 \001(\004H\000\022\014\n\004size\030\004 \001(\004\022.\n\005edg"
|
||||
"es\030\005 \003(\0132\037.mozilla.devtools.protobuf.Edg"
|
||||
"e\022>\n\017allocationStack\030\006 \001(\0132%.mozilla.dev"
|
||||
"tools.protobuf.StackFrame\022\033\n\021jsObjectCla"
|
||||
"ssName\030\007 \001(\014H\001\022\036\n\024jsObjectClassNameRef\030\010"
|
||||
" \001(\004H\001\022\025\n\ncoarseType\030\t \001(\r:\0010B\017\n\rTypeNam"
|
||||
"eOrRefB\030\n\026JSObjectClassNameOrRef\"L\n\004Edge"
|
||||
"\022\020\n\010referent\030\001 \001(\004\022\016\n\004name\030\002 \001(\014H\000\022\021\n\007na"
|
||||
"meRef\030\003 \001(\004H\000B\017\n\rEdgeNameOrRef", 870);
|
||||
" \001(\004H\001\022\025\n\ncoarseType\030\t \001(\r:\0010\022\030\n\016scriptF"
|
||||
"ilename\030\n \001(\014H\002\022\033\n\021scriptFilenameRef\030\013 \001"
|
||||
"(\004H\002B\017\n\rTypeNameOrRefB\030\n\026JSObjectClassNa"
|
||||
"meOrRefB\025\n\023ScriptFilenameOrRef\"L\n\004Edge\022\020"
|
||||
"\n\010referent\030\001 \001(\004\022\016\n\004name\030\002 \001(\014H\000\022\021\n\007name"
|
||||
"Ref\030\003 \001(\004H\000B\017\n\rEdgeNameOrRef", 948);
|
||||
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
|
||||
"CoreDump.proto", &protobuf_RegisterTypes);
|
||||
Metadata::default_instance_ = new Metadata();
|
||||
@ -1462,6 +1469,8 @@ const int Node::kAllocationStackFieldNumber;
|
||||
const int Node::kJsObjectClassNameFieldNumber;
|
||||
const int Node::kJsObjectClassNameRefFieldNumber;
|
||||
const int Node::kCoarseTypeFieldNumber;
|
||||
const int Node::kScriptFilenameFieldNumber;
|
||||
const int Node::kScriptFilenameRefFieldNumber;
|
||||
#endif // !_MSC_VER
|
||||
|
||||
Node::Node()
|
||||
@ -1476,6 +1485,8 @@ void Node::InitAsDefaultInstance() {
|
||||
allocationstack_ = const_cast< ::mozilla::devtools::protobuf::StackFrame*>(&::mozilla::devtools::protobuf::StackFrame::default_instance());
|
||||
Node_default_oneof_instance_->jsobjectclassname_ = &::google::protobuf::internal::GetEmptyStringAlreadyInited();
|
||||
Node_default_oneof_instance_->jsobjectclassnameref_ = GOOGLE_ULONGLONG(0);
|
||||
Node_default_oneof_instance_->scriptfilename_ = &::google::protobuf::internal::GetEmptyStringAlreadyInited();
|
||||
Node_default_oneof_instance_->scriptfilenameref_ = GOOGLE_ULONGLONG(0);
|
||||
}
|
||||
|
||||
Node::Node(const Node& from)
|
||||
@ -1495,6 +1506,7 @@ void Node::SharedCtor() {
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
clear_has_TypeNameOrRef();
|
||||
clear_has_JSObjectClassNameOrRef();
|
||||
clear_has_ScriptFilenameOrRef();
|
||||
}
|
||||
|
||||
Node::~Node() {
|
||||
@ -1509,6 +1521,9 @@ void Node::SharedDtor() {
|
||||
if (has_JSObjectClassNameOrRef()) {
|
||||
clear_JSObjectClassNameOrRef();
|
||||
}
|
||||
if (has_ScriptFilenameOrRef()) {
|
||||
clear_ScriptFilenameOrRef();
|
||||
}
|
||||
if (this != default_instance_) {
|
||||
delete allocationstack_;
|
||||
}
|
||||
@ -1569,6 +1584,23 @@ void Node::clear_JSObjectClassNameOrRef() {
|
||||
_oneof_case_[1] = JSOBJECTCLASSNAMEORREF_NOT_SET;
|
||||
}
|
||||
|
||||
void Node::clear_ScriptFilenameOrRef() {
|
||||
switch(ScriptFilenameOrRef_case()) {
|
||||
case kScriptFilename: {
|
||||
delete ScriptFilenameOrRef_.scriptfilename_;
|
||||
break;
|
||||
}
|
||||
case kScriptFilenameRef: {
|
||||
// No need to clear
|
||||
break;
|
||||
}
|
||||
case SCRIPTFILENAMEORREF_NOT_SET: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
_oneof_case_[2] = SCRIPTFILENAMEORREF_NOT_SET;
|
||||
}
|
||||
|
||||
|
||||
void Node::Clear() {
|
||||
#define OFFSET_OF_FIELD_(f) (reinterpret_cast<char*>( \
|
||||
@ -1595,6 +1627,7 @@ void Node::Clear() {
|
||||
edges_.Clear();
|
||||
clear_TypeNameOrRef();
|
||||
clear_JSObjectClassNameOrRef();
|
||||
clear_ScriptFilenameOrRef();
|
||||
::memset(_has_bits_, 0, sizeof(_has_bits_));
|
||||
mutable_unknown_fields()->Clear();
|
||||
}
|
||||
@ -1734,6 +1767,35 @@ bool Node::MergePartialFromCodedStream(
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
if (input->ExpectTag(82)) goto parse_scriptFilename;
|
||||
break;
|
||||
}
|
||||
|
||||
// optional bytes scriptFilename = 10;
|
||||
case 10: {
|
||||
if (tag == 82) {
|
||||
parse_scriptFilename:
|
||||
DO_(::google::protobuf::internal::WireFormatLite::ReadBytes(
|
||||
input, this->mutable_scriptfilename()));
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
if (input->ExpectTag(88)) goto parse_scriptFilenameRef;
|
||||
break;
|
||||
}
|
||||
|
||||
// optional uint64 scriptFilenameRef = 11;
|
||||
case 11: {
|
||||
if (tag == 88) {
|
||||
parse_scriptFilenameRef:
|
||||
clear_ScriptFilenameOrRef();
|
||||
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
|
||||
::google::protobuf::uint64, ::google::protobuf::internal::WireFormatLite::TYPE_UINT64>(
|
||||
input, &ScriptFilenameOrRef_.scriptfilenameref_)));
|
||||
set_has_scriptfilenameref();
|
||||
} else {
|
||||
goto handle_unusual;
|
||||
}
|
||||
if (input->ExpectAtEnd()) goto success;
|
||||
break;
|
||||
}
|
||||
@ -1812,6 +1874,17 @@ void Node::SerializeWithCachedSizes(
|
||||
::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->coarsetype(), output);
|
||||
}
|
||||
|
||||
// optional bytes scriptFilename = 10;
|
||||
if (has_scriptfilename()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteBytesMaybeAliased(
|
||||
10, this->scriptfilename(), output);
|
||||
}
|
||||
|
||||
// optional uint64 scriptFilenameRef = 11;
|
||||
if (has_scriptfilenameref()) {
|
||||
::google::protobuf::internal::WireFormatLite::WriteUInt64(11, this->scriptfilenameref(), output);
|
||||
}
|
||||
|
||||
if (!unknown_fields().empty()) {
|
||||
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
|
||||
unknown_fields(), output);
|
||||
@ -1875,6 +1948,18 @@ void Node::SerializeWithCachedSizes(
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(9, this->coarsetype(), target);
|
||||
}
|
||||
|
||||
// optional bytes scriptFilename = 10;
|
||||
if (has_scriptfilename()) {
|
||||
target =
|
||||
::google::protobuf::internal::WireFormatLite::WriteBytesToArray(
|
||||
10, this->scriptfilename(), target);
|
||||
}
|
||||
|
||||
// optional uint64 scriptFilenameRef = 11;
|
||||
if (has_scriptfilenameref()) {
|
||||
target = ::google::protobuf::internal::WireFormatLite::WriteUInt64ToArray(11, this->scriptfilenameref(), target);
|
||||
}
|
||||
|
||||
if (!unknown_fields().empty()) {
|
||||
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
|
||||
unknown_fields(), target);
|
||||
@ -1964,6 +2049,25 @@ int Node::ByteSize() const {
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (ScriptFilenameOrRef_case()) {
|
||||
// optional bytes scriptFilename = 10;
|
||||
case kScriptFilename: {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::BytesSize(
|
||||
this->scriptfilename());
|
||||
break;
|
||||
}
|
||||
// optional uint64 scriptFilenameRef = 11;
|
||||
case kScriptFilenameRef: {
|
||||
total_size += 1 +
|
||||
::google::protobuf::internal::WireFormatLite::UInt64Size(
|
||||
this->scriptfilenameref());
|
||||
break;
|
||||
}
|
||||
case SCRIPTFILENAMEORREF_NOT_SET: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!unknown_fields().empty()) {
|
||||
total_size +=
|
||||
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
|
||||
@ -2016,6 +2120,19 @@ void Node::MergeFrom(const Node& from) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
switch (from.ScriptFilenameOrRef_case()) {
|
||||
case kScriptFilename: {
|
||||
set_scriptfilename(from.scriptfilename());
|
||||
break;
|
||||
}
|
||||
case kScriptFilenameRef: {
|
||||
set_scriptfilenameref(from.scriptfilenameref());
|
||||
break;
|
||||
}
|
||||
case SCRIPTFILENAMEORREF_NOT_SET: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
|
||||
if (from.has_id()) {
|
||||
set_id(from.id());
|
||||
@ -2063,6 +2180,8 @@ void Node::Swap(Node* other) {
|
||||
std::swap(_oneof_case_[0], other->_oneof_case_[0]);
|
||||
std::swap(JSObjectClassNameOrRef_, other->JSObjectClassNameOrRef_);
|
||||
std::swap(_oneof_case_[1], other->_oneof_case_[1]);
|
||||
std::swap(ScriptFilenameOrRef_, other->ScriptFilenameOrRef_);
|
||||
std::swap(_oneof_case_[2], other->_oneof_case_[2]);
|
||||
std::swap(_has_bits_[0], other->_has_bits_[0]);
|
||||
_unknown_fields_.Swap(&other->_unknown_fields_);
|
||||
std::swap(_cached_size_, other->_cached_size_);
|
||||
|
@ -468,6 +468,12 @@ class Node : public ::google::protobuf::Message {
|
||||
JSOBJECTCLASSNAMEORREF_NOT_SET = 0,
|
||||
};
|
||||
|
||||
enum ScriptFilenameOrRefCase {
|
||||
kScriptFilename = 10,
|
||||
kScriptFilenameRef = 11,
|
||||
SCRIPTFILENAMEORREF_NOT_SET = 0,
|
||||
};
|
||||
|
||||
void Swap(Node* other);
|
||||
|
||||
// implements Message ----------------------------------------------
|
||||
@ -578,8 +584,28 @@ class Node : public ::google::protobuf::Message {
|
||||
inline ::google::protobuf::uint32 coarsetype() const;
|
||||
inline void set_coarsetype(::google::protobuf::uint32 value);
|
||||
|
||||
// optional bytes scriptFilename = 10;
|
||||
inline bool has_scriptfilename() const;
|
||||
inline void clear_scriptfilename();
|
||||
static const int kScriptFilenameFieldNumber = 10;
|
||||
inline const ::std::string& scriptfilename() const;
|
||||
inline void set_scriptfilename(const ::std::string& value);
|
||||
inline void set_scriptfilename(const char* value);
|
||||
inline void set_scriptfilename(const void* value, size_t size);
|
||||
inline ::std::string* mutable_scriptfilename();
|
||||
inline ::std::string* release_scriptfilename();
|
||||
inline void set_allocated_scriptfilename(::std::string* scriptfilename);
|
||||
|
||||
// optional uint64 scriptFilenameRef = 11;
|
||||
inline bool has_scriptfilenameref() const;
|
||||
inline void clear_scriptfilenameref();
|
||||
static const int kScriptFilenameRefFieldNumber = 11;
|
||||
inline ::google::protobuf::uint64 scriptfilenameref() const;
|
||||
inline void set_scriptfilenameref(::google::protobuf::uint64 value);
|
||||
|
||||
inline TypeNameOrRefCase TypeNameOrRef_case() const;
|
||||
inline JSObjectClassNameOrRefCase JSObjectClassNameOrRef_case() const;
|
||||
inline ScriptFilenameOrRefCase ScriptFilenameOrRef_case() const;
|
||||
// @@protoc_insertion_point(class_scope:mozilla.devtools.protobuf.Node)
|
||||
private:
|
||||
inline void set_has_id();
|
||||
@ -594,6 +620,8 @@ class Node : public ::google::protobuf::Message {
|
||||
inline void set_has_jsobjectclassnameref();
|
||||
inline void set_has_coarsetype();
|
||||
inline void clear_has_coarsetype();
|
||||
inline void set_has_scriptfilename();
|
||||
inline void set_has_scriptfilenameref();
|
||||
|
||||
inline bool has_TypeNameOrRef();
|
||||
void clear_TypeNameOrRef();
|
||||
@ -603,6 +631,10 @@ class Node : public ::google::protobuf::Message {
|
||||
void clear_JSObjectClassNameOrRef();
|
||||
inline void clear_has_JSObjectClassNameOrRef();
|
||||
|
||||
inline bool has_ScriptFilenameOrRef();
|
||||
void clear_ScriptFilenameOrRef();
|
||||
inline void clear_has_ScriptFilenameOrRef();
|
||||
|
||||
::google::protobuf::UnknownFieldSet _unknown_fields_;
|
||||
|
||||
::google::protobuf::uint32 _has_bits_[1];
|
||||
@ -620,7 +652,11 @@ class Node : public ::google::protobuf::Message {
|
||||
::std::string* jsobjectclassname_;
|
||||
::google::protobuf::uint64 jsobjectclassnameref_;
|
||||
} JSObjectClassNameOrRef_;
|
||||
::google::protobuf::uint32 _oneof_case_[2];
|
||||
union ScriptFilenameOrRefUnion {
|
||||
::std::string* scriptfilename_;
|
||||
::google::protobuf::uint64 scriptfilenameref_;
|
||||
} ScriptFilenameOrRef_;
|
||||
::google::protobuf::uint32 _oneof_case_[3];
|
||||
|
||||
friend void protobuf_AddDesc_CoreDump_2eproto();
|
||||
friend void protobuf_AssignDesc_CoreDump_2eproto();
|
||||
@ -1578,6 +1614,103 @@ inline void Node::set_coarsetype(::google::protobuf::uint32 value) {
|
||||
// @@protoc_insertion_point(field_set:mozilla.devtools.protobuf.Node.coarseType)
|
||||
}
|
||||
|
||||
// optional bytes scriptFilename = 10;
|
||||
inline bool Node::has_scriptfilename() const {
|
||||
return ScriptFilenameOrRef_case() == kScriptFilename;
|
||||
}
|
||||
inline void Node::set_has_scriptfilename() {
|
||||
_oneof_case_[2] = kScriptFilename;
|
||||
}
|
||||
inline void Node::clear_scriptfilename() {
|
||||
if (has_scriptfilename()) {
|
||||
delete ScriptFilenameOrRef_.scriptfilename_;
|
||||
clear_has_ScriptFilenameOrRef();
|
||||
}
|
||||
}
|
||||
inline const ::std::string& Node::scriptfilename() const {
|
||||
if (has_scriptfilename()) {
|
||||
return *ScriptFilenameOrRef_.scriptfilename_;
|
||||
}
|
||||
return ::google::protobuf::internal::GetEmptyStringAlreadyInited();
|
||||
}
|
||||
inline void Node::set_scriptfilename(const ::std::string& value) {
|
||||
if (!has_scriptfilename()) {
|
||||
clear_ScriptFilenameOrRef();
|
||||
set_has_scriptfilename();
|
||||
ScriptFilenameOrRef_.scriptfilename_ = new ::std::string;
|
||||
}
|
||||
ScriptFilenameOrRef_.scriptfilename_->assign(value);
|
||||
}
|
||||
inline void Node::set_scriptfilename(const char* value) {
|
||||
if (!has_scriptfilename()) {
|
||||
clear_ScriptFilenameOrRef();
|
||||
set_has_scriptfilename();
|
||||
ScriptFilenameOrRef_.scriptfilename_ = new ::std::string;
|
||||
}
|
||||
ScriptFilenameOrRef_.scriptfilename_->assign(value);
|
||||
}
|
||||
inline void Node::set_scriptfilename(const void* value, size_t size) {
|
||||
if (!has_scriptfilename()) {
|
||||
clear_ScriptFilenameOrRef();
|
||||
set_has_scriptfilename();
|
||||
ScriptFilenameOrRef_.scriptfilename_ = new ::std::string;
|
||||
}
|
||||
ScriptFilenameOrRef_.scriptfilename_->assign(
|
||||
reinterpret_cast<const char*>(value), size);
|
||||
}
|
||||
inline ::std::string* Node::mutable_scriptfilename() {
|
||||
if (!has_scriptfilename()) {
|
||||
clear_ScriptFilenameOrRef();
|
||||
set_has_scriptfilename();
|
||||
ScriptFilenameOrRef_.scriptfilename_ = new ::std::string;
|
||||
}
|
||||
return ScriptFilenameOrRef_.scriptfilename_;
|
||||
}
|
||||
inline ::std::string* Node::release_scriptfilename() {
|
||||
if (has_scriptfilename()) {
|
||||
clear_has_ScriptFilenameOrRef();
|
||||
::std::string* temp = ScriptFilenameOrRef_.scriptfilename_;
|
||||
ScriptFilenameOrRef_.scriptfilename_ = NULL;
|
||||
return temp;
|
||||
} else {
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
inline void Node::set_allocated_scriptfilename(::std::string* scriptfilename) {
|
||||
clear_ScriptFilenameOrRef();
|
||||
if (scriptfilename) {
|
||||
set_has_scriptfilename();
|
||||
ScriptFilenameOrRef_.scriptfilename_ = scriptfilename;
|
||||
}
|
||||
}
|
||||
|
||||
// optional uint64 scriptFilenameRef = 11;
|
||||
inline bool Node::has_scriptfilenameref() const {
|
||||
return ScriptFilenameOrRef_case() == kScriptFilenameRef;
|
||||
}
|
||||
inline void Node::set_has_scriptfilenameref() {
|
||||
_oneof_case_[2] = kScriptFilenameRef;
|
||||
}
|
||||
inline void Node::clear_scriptfilenameref() {
|
||||
if (has_scriptfilenameref()) {
|
||||
ScriptFilenameOrRef_.scriptfilenameref_ = GOOGLE_ULONGLONG(0);
|
||||
clear_has_ScriptFilenameOrRef();
|
||||
}
|
||||
}
|
||||
inline ::google::protobuf::uint64 Node::scriptfilenameref() const {
|
||||
if (has_scriptfilenameref()) {
|
||||
return ScriptFilenameOrRef_.scriptfilenameref_;
|
||||
}
|
||||
return GOOGLE_ULONGLONG(0);
|
||||
}
|
||||
inline void Node::set_scriptfilenameref(::google::protobuf::uint64 value) {
|
||||
if (!has_scriptfilenameref()) {
|
||||
clear_ScriptFilenameOrRef();
|
||||
set_has_scriptfilenameref();
|
||||
}
|
||||
ScriptFilenameOrRef_.scriptfilenameref_ = value;
|
||||
}
|
||||
|
||||
inline bool Node::has_TypeNameOrRef() {
|
||||
return TypeNameOrRef_case() != TYPENAMEORREF_NOT_SET;
|
||||
}
|
||||
@ -1590,12 +1723,21 @@ inline bool Node::has_JSObjectClassNameOrRef() {
|
||||
inline void Node::clear_has_JSObjectClassNameOrRef() {
|
||||
_oneof_case_[1] = JSOBJECTCLASSNAMEORREF_NOT_SET;
|
||||
}
|
||||
inline bool Node::has_ScriptFilenameOrRef() {
|
||||
return ScriptFilenameOrRef_case() != SCRIPTFILENAMEORREF_NOT_SET;
|
||||
}
|
||||
inline void Node::clear_has_ScriptFilenameOrRef() {
|
||||
_oneof_case_[2] = SCRIPTFILENAMEORREF_NOT_SET;
|
||||
}
|
||||
inline Node::TypeNameOrRefCase Node::TypeNameOrRef_case() const {
|
||||
return Node::TypeNameOrRefCase(_oneof_case_[0]);
|
||||
}
|
||||
inline Node::JSObjectClassNameOrRefCase Node::JSObjectClassNameOrRef_case() const {
|
||||
return Node::JSObjectClassNameOrRefCase(_oneof_case_[1]);
|
||||
}
|
||||
inline Node::ScriptFilenameOrRefCase Node::ScriptFilenameOrRef_case() const {
|
||||
return Node::ScriptFilenameOrRefCase(_oneof_case_[2]);
|
||||
}
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
// Edge
|
||||
|
@ -123,6 +123,12 @@ message Node {
|
||||
|
||||
// JS::ubi::CoarseType. Defaults to Other.
|
||||
optional uint32 coarseType = 9 [default = 0];
|
||||
|
||||
// De-duplicated one-byte string.
|
||||
oneof ScriptFilenameOrRef {
|
||||
bytes scriptFilename = 10;
|
||||
uint64 scriptFilenameRef = 11;
|
||||
}
|
||||
}
|
||||
|
||||
// A serialized edge from the heap graph.
|
||||
|
@ -67,6 +67,8 @@ struct DeserializedNode {
|
||||
Maybe<StackFrameId> allocationStack;
|
||||
// A borrowed reference to a string owned by this node's owning HeapSnapshot.
|
||||
const char* jsObjectClassName;
|
||||
// A borrowed reference to a string owned by this node's owning HeapSnapshot.
|
||||
const char* scriptFilename;
|
||||
// A weak pointer to this node's owning `HeapSnapshot`. Safe without
|
||||
// AddRef'ing because this node's lifetime is equal to that of its owner.
|
||||
HeapSnapshot* owner;
|
||||
@ -78,6 +80,7 @@ struct DeserializedNode {
|
||||
EdgeVector&& edges,
|
||||
Maybe<StackFrameId> allocationStack,
|
||||
const char* className,
|
||||
const char* filename,
|
||||
HeapSnapshot& owner)
|
||||
: id(id)
|
||||
, coarseType(coarseType)
|
||||
@ -86,6 +89,7 @@ struct DeserializedNode {
|
||||
, edges(Move(edges))
|
||||
, allocationStack(allocationStack)
|
||||
, jsObjectClassName(className)
|
||||
, scriptFilename(filename)
|
||||
, owner(&owner)
|
||||
{ }
|
||||
virtual ~DeserializedNode() { }
|
||||
@ -98,6 +102,7 @@ struct DeserializedNode {
|
||||
, edges(Move(rhs.edges))
|
||||
, allocationStack(rhs.allocationStack)
|
||||
, jsObjectClassName(rhs.jsObjectClassName)
|
||||
, scriptFilename(rhs.scriptFilename)
|
||||
, owner(rhs.owner)
|
||||
{ }
|
||||
|
||||
@ -125,6 +130,7 @@ protected:
|
||||
, edges()
|
||||
, allocationStack(Nothing())
|
||||
, jsObjectClassName(nullptr)
|
||||
, scriptFilename(nullptr)
|
||||
, owner(nullptr)
|
||||
{ }
|
||||
|
||||
@ -260,6 +266,7 @@ public:
|
||||
const char16_t* typeName() const override;
|
||||
Node::Size size(mozilla::MallocSizeOf mallocSizeof) const override;
|
||||
const char* jsObjectClassName() const override { return get().jsObjectClassName; }
|
||||
const char* scriptFilename() const final { return get().scriptFilename; }
|
||||
|
||||
bool hasAllocationStack() const override { return get().allocationStack.isSome(); }
|
||||
StackFrame allocationStack() const override;
|
||||
|
@ -276,10 +276,19 @@ HeapSnapshot::saveNode(const protobuf::Node& node)
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* scriptFilename = nullptr;
|
||||
if (node.ScriptFilenameOrRef_case() != protobuf::Node::SCRIPTFILENAMEORREF_NOT_SET) {
|
||||
Maybe<StringOrRef> scriptFilenameOrRef = GET_STRING_OR_REF(node, scriptfilename);
|
||||
scriptFilename = getOrInternString<char>(internedOneByteStrings, scriptFilenameOrRef);
|
||||
if (NS_WARN_IF(!scriptFilename))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (NS_WARN_IF(!nodes.putNew(id, DeserializedNode(id, coarseType, typeName,
|
||||
size, Move(edges),
|
||||
allocationStack,
|
||||
jsObjectClassName, *this))))
|
||||
jsObjectClassName,
|
||||
scriptFilename, *this))))
|
||||
{
|
||||
return false;
|
||||
};
|
||||
@ -1079,6 +1088,15 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
if (auto scriptFilename = ubiNode.scriptFilename()) {
|
||||
if (NS_WARN_IF(!attachOneByteString(scriptFilename,
|
||||
[&] (std::string* name) { protobufNode.set_allocated_scriptfilename(name); },
|
||||
[&] (uint64_t ref) { protobufNode.set_scriptfilenameref(ref); })))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return writeMessage(protobufNode);
|
||||
}
|
||||
};
|
||||
|
@ -39,12 +39,14 @@ size_t fakeMallocSizeOf(const void*) {
|
||||
DEF_TEST(DeserializedNodeUbiNodes, {
|
||||
const char16_t* typeName = MOZ_UTF16("TestTypeName");
|
||||
const char* className = "MyObjectClassName";
|
||||
const char* filename = "my-cool-filename.js";
|
||||
|
||||
NodeId id = uint64_t(1) << 33;
|
||||
uint64_t size = uint64_t(1) << 60;
|
||||
MockDeserializedNode mocked(id, typeName, size);
|
||||
mocked.coarseType = JS::ubi::CoarseType::Script;
|
||||
mocked.jsObjectClassName = className;
|
||||
mocked.scriptFilename = filename;
|
||||
|
||||
DeserializedNode& deserialized = mocked;
|
||||
JS::ubi::Node ubi(&deserialized);
|
||||
@ -57,6 +59,7 @@ DEF_TEST(DeserializedNodeUbiNodes, {
|
||||
EXPECT_EQ(id, ubi.identifier());
|
||||
EXPECT_FALSE(ubi.isLive());
|
||||
EXPECT_EQ(ubi.jsObjectClassName(), className);
|
||||
EXPECT_EQ(ubi.scriptFilename(), filename);
|
||||
|
||||
// Test the ubi::Node's edges.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user