void HeapGraphSerializer::reportNode(const WTF::MemoryObjectInfo& info) { HeapGraphNode node; node.m_type = addString(info.objectType()); node.m_size = info.objectSize(); node.m_className = addString(info.className()); node.m_name = addString(info.name()); // Node is always reported after its outgoing edges and leaves. node.m_edgeCount = m_edges.size() - m_lastReportedEdgeIndex; m_lastReportedEdgeIndex = m_edges.size(); m_objectToNodeIndex.set(info.reportedPointer(), m_nodes.size()); m_nodes.append(node); }
void HeapGraphSerializer::reportLeaf(const void*, const WTF::MemoryObjectInfo& info, const char* edgeName) { HeapGraphNode node; node.m_type = addString(info.objectType()); node.m_size = info.objectSize(); node.m_className = addString(info.className()); node.m_name = addString(info.name()); int nodeIndex = m_nodes.size(); m_nodes.append(node); HeapGraphEdge edge; edge.m_toIndex = nodeIndex; edge.m_targetIndexIsKnown = true; edge.m_name = addString(edgeName); m_edges.append(edge); }