mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-24 09:52:31 +00:00
LibIPC: Do not require constructing containers when sending IPC messages
For example, consider the following IPC message: do_something(u64 page_id, String string, Vector<Data> data) =| We would previously generate the following C++ method to encode/transfer this message: void do_something(u64 page_id, String string, Vector<Data> data); This required the caller to either have to copy the non-trivial types or `move` them in. In some places, this meant we had to construct temporary vectors just to send an IPC. This isn't necessary because we weren't holding onto these parameters anyways. We would construct an IPC::Message subclass with them (which does require owning types), but then immediate encode the message to an IPC::MessageBuffer and send it. We now generate code such that we don't need to construct a Message. We can simply encode the parameters directly without needing ownership. This allows us to take view-types to IPC parameters. So the above example now becomes: void do_something(u64, StringView, ReadonlySpan<Data>);
This commit is contained in:
parent
da6c6487e5
commit
68947d55d9
Notes:
github-actions[bot]
2025-03-09 15:15:56 +00:00
Author: https://github.com/trflynn89
Commit: 68947d55d9
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3865
5 changed files with 118 additions and 41 deletions
|
@ -449,7 +449,7 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const
|
|||
auto* node = Web::DOM::Node::from_unique_id(node_id);
|
||||
// Note: Nodes without layout (aka non-visible nodes, don't have style computed)
|
||||
if (!node || !node->layout_node()) {
|
||||
async_did_inspect_dom_node(page_id, false, {}, {}, {}, {}, {}, {});
|
||||
async_did_inspect_dom_node(page_id, false, String {}, String {}, String {}, String {}, String {}, String {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -458,7 +458,7 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const
|
|||
if (node->is_element()) {
|
||||
auto& element = as<Web::DOM::Element>(*node);
|
||||
if (!element.computed_properties()) {
|
||||
async_did_inspect_dom_node(page_id, false, {}, {}, {}, {}, {}, {});
|
||||
async_did_inspect_dom_node(page_id, false, String {}, String {}, String {}, String {}, String {}, String {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -562,7 +562,7 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const
|
|||
if (pseudo_element.has_value()) {
|
||||
auto pseudo_element_node = element.get_pseudo_element_node(pseudo_element.value());
|
||||
if (!pseudo_element_node) {
|
||||
async_did_inspect_dom_node(page_id, false, {}, {}, {}, {}, {}, {});
|
||||
async_did_inspect_dom_node(page_id, false, String {}, String {}, String {}, String {}, String {}, String {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -596,7 +596,7 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const
|
|||
return;
|
||||
}
|
||||
|
||||
async_did_inspect_dom_node(page_id, false, {}, {}, {}, {}, {}, {});
|
||||
async_did_inspect_dom_node(page_id, false, String {}, String {}, String {}, String {}, String {}, String {});
|
||||
}
|
||||
|
||||
void ConnectionFromClient::highlight_dom_node(u64 page_id, Web::UniqueNodeID const& node_id, Optional<Web::CSS::Selector::PseudoElement::Type> const& pseudo_element)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue