v8  7.8.279(node12.19.0)
V8 is Google's open source JavaScript engine
EmbedderGraph Class Referenceabstract

#include <v8-profiler.h>

Data Structures

class  Node

Public Member Functions

virtual NodeV8Node (const v8::Local< v8::Value > &value)=0
virtual NodeAddNode (std::unique_ptr< Node > node)=0
virtual void AddEdge (Node *from, Node *to, const char *name=nullptr)=0
virtual ~EmbedderGraph ()=default

Detailed Description

An object graph consisting of embedder objects and V8 objects. Edges of the graph are strong references between the objects. The embedder can build this graph during heap snapshot generation to include the embedder objects in the heap snapshot. Usage: 1) Define derived class of EmbedderGraph::Node for embedder objects. 2) Set the build embedder graph callback on the heap profiler using HeapProfiler::AddBuildEmbedderGraphCallback. 3) In the callback use graph->AddEdge(node1, node2) to add an edge from node1 to node2. 4) To represent references from/to V8 object, construct V8 nodes using graph->V8Node(value).

Definition at line 728 of file v8-profiler.h.

Constructor & Destructor Documentation

◆ ~EmbedderGraph()

virtual ~EmbedderGraph ( )

Member Function Documentation

◆ AddEdge()

virtual void AddEdge ( Node from,
Node to,
const char *  name = nullptr 
pure virtual

Adds an edge that represents a strong reference from the given node |from| to the given node |to|. The nodes must be added to the graph before calling this function.

If name is nullptr, the edge will have auto-increment indexes, otherwise it will be named accordingly.

◆ AddNode()

virtual Node* AddNode ( std::unique_ptr< Node node)
pure virtual

Adds the given node to the graph and takes ownership of the node. Returns a raw pointer to the node that is valid while the graph is alive.

◆ V8Node()

virtual Node* V8Node ( const v8::Local< v8::Value > &  value)
pure virtual

Returns a node corresponding to the given V8 value. Ownership is not transferred. The result pointer is valid while the graph is alive.

The documentation for this class was generated from the following file: