refactor: update gin_helper/function_template (#41534)

* refactor: update gin_helper/function_template

* fix: crash in Node.js Worker threads
This commit is contained in:
Shelley Vohr 2024-03-25 10:01:54 +01:00 committed by GitHub
parent ed28ead8ac
commit 8c427253b3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 271 additions and 114 deletions

View file

@ -132,8 +132,9 @@ template <typename ReturnType, typename... ArgTypes>
struct NativeFunctionInvoker<ReturnType(ArgTypes...)> {
static void Go(base::RepeatingCallback<ReturnType(ArgTypes...)> val,
gin::Arguments* args) {
using Indices = typename IndicesGenerator<sizeof...(ArgTypes)>::type;
Invoker<Indices, ArgTypes...> invoker(args, 0);
using Indices = std::index_sequence_for<ArgTypes...>;
Invoker<Indices, ArgTypes...> invoker(args,
{.holder_is_first_argument = false});
if (invoker.IsOK())
invoker.DispatchToCallback(val);
}