utils: ipc: Do not define variables in signal handler up front
Defining the variables at the beginning of the function forces the types to be default constructible, which may not be desirable; furthermore, it also forces the move/copy assignment operator to be used when the deserialized value is retrieved. Having `T val = f()` has the advantage of benefitting from potential RVO as well as not requiring `T` to be default constructible, so generate code in that form by calling `deserialize_call()` with `declare=true`. Signed-off-by: Barnabás Pőcze <barnabas.pocze@ideasonboard.com> Reviewed-by: Paul Elder <paul.elder@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
This commit is contained in:
parent
f31da7272e
commit
e1818265ae
1 changed files with 1 additions and 4 deletions
|
@ -239,10 +239,7 @@ void {{proxy_name}}::{{method.mojom_name}}IPC(
|
||||||
[[maybe_unused]] size_t dataSize,
|
[[maybe_unused]] size_t dataSize,
|
||||||
[[maybe_unused]] const std::vector<SharedFD> &fds)
|
[[maybe_unused]] const std::vector<SharedFD> &fds)
|
||||||
{
|
{
|
||||||
{%- for param in method.parameters %}
|
{{proxy_funcs.deserialize_call(method.parameters, 'data', 'fds', false, true, true, 'dataSize')}}
|
||||||
{{param|name}} {{param.mojom_name}};
|
|
||||||
{%- endfor %}
|
|
||||||
{{proxy_funcs.deserialize_call(method.parameters, 'data', 'fds', false, false, true, 'dataSize')}}
|
|
||||||
{{method.mojom_name}}.emit({{method.parameters|params_comma_sep}});
|
{{method.mojom_name}}.emit({{method.parameters|params_comma_sep}});
|
||||||
}
|
}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue