1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:47:35 +00:00

LibWeb: Do not create copies of JSON values in OOPWV DOM Inspector

To improve the performance of the DOM Inspector when the Browser is run
in multi-process mode, do not create copies of the JSON values sent via
IPC when searching for a model index. Methods that are guaranteed to
return a value now return a reference. Methods that do not have such a
guarantee return a pointer (rather than an Optional, because Optional
cannot hold references).

The DOM Inspector performs well at first, but will start lagging again
once the tree is expanded a few nodes deep and/or with many nodes
visible in the tree.
This commit is contained in:
Timothy Flynn 2021-06-30 07:07:38 -04:00 committed by Andreas Kling
parent 7d055dd039
commit 7604c2f38e
2 changed files with 64 additions and 54 deletions

View file

@ -36,16 +36,16 @@ public:
private:
explicit DOMTreeJSONModel(JsonObject);
Optional<JsonObject> find_parent_of_child_with_internal_id(size_t) const;
Optional<JsonObject> find_parent_of_child_with_internal_id(JsonObject, size_t) const;
JsonObject const* find_parent_of_child_with_internal_id(size_t) const;
JsonObject const* find_parent_of_child_with_internal_id(JsonObject const&, size_t) const;
Optional<JsonObject> find_child_with_internal_id(size_t) const;
Optional<JsonObject> find_child_with_internal_id(JsonObject, size_t) const;
JsonObject const* find_child_with_internal_id(size_t) const;
JsonObject const* find_child_with_internal_id(JsonObject const&, size_t) const;
JsonObject find_node(GUI::ModelIndex) const;
JsonObject const& find_node(GUI::ModelIndex const&) const;
static size_t get_internal_id(const JsonObject& o);
static JsonArray get_children(const JsonObject& o);
static JsonArray const* get_children(const JsonObject& o);
GUI::Icon m_document_icon;
GUI::Icon m_element_icon;