1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 23:47:45 +00:00

LibWeb: Give each Node a unique ID

We maintain a directory of ID -> Node. Nodes add themselves to this
directory when they are created, receiving a random ID. When a Node is
destroyed, it removes itself from this directory. Anyone can request a
Node from the directory by its ID using `Node::from_id()`.

We reserve the `0` ID to mean "none".

These IDs allow different processes to communicate about a given Node
over IPC, for example the DOM Inspector.
This commit is contained in:
Sam Atkins 2021-08-30 15:52:08 +01:00 committed by Andreas Kling
parent 48a2239f60
commit d7485df928
3 changed files with 33 additions and 0 deletions

View file

@ -8,6 +8,7 @@
#include <AK/FlyString.h>
#include <AK/Function.h>
#include <AK/HashMap.h>
#include <AK/NonnullRefPtrVector.h>
#include <AK/OwnPtr.h>
#include <AK/String.h>