[wgpu-headers] Make lambda callbacks allocate via move.
- This allows the lambdas to capture via move.
Bug: 42241461
Change-Id: Id6a68b31b98cb3688c5f10c2641b92ccf613a037
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/194520
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Loko Kung <lokokung@google.com>
diff --git a/generator/templates/api_cpp.h b/generator/templates/api_cpp.h
index 70f88c6..a56b331 100644
--- a/generator/templates/api_cpp.h
+++ b/generator/templates/api_cpp.h
@@ -427,7 +427,7 @@
callbackInfo);
return {{convert_cType_to_cppType(method.return_type, 'value', 'result') | indent(8)}};
} else {
- auto* lambda = new L(callback);
+ auto* lambda = new L(std::move(callback));
callbackInfo.callback = [](
{%- for arg in CallbackType.arguments -%}
{{as_annotated_cType(arg)}}{{", "}}