Migrate the shell unit tests from legacy Dart native functions to FFI by jason-simmons · Pull Request #190473 · flutter/flutter · GitHub
Skip to content

Migrate the shell unit tests from legacy Dart native functions to FFI - #190473

Merged
auto-submit[bot] merged 2 commits into
flutter:masterfrom
jason-simmons:bug_190154
Aug 5, 2026
Merged

Migrate the shell unit tests from legacy Dart native functions to FFI#190473
auto-submit[bot] merged 2 commits into
flutter:masterfrom
jason-simmons:bug_190154

Conversation

@jason-simmons

Copy link
Copy Markdown
Member

This adds a CREATE_FFI_LAMBDA macro that can be used to register a lambda as a Dart FFI function (similar to how CREATE_NATIVE_ENTRY works for the old native function API).

The native functions also had to be ported from the Dart_NativeArguments API to FFI-style function signatures.

See #190154

@flutter-dashboard flutter-dashboard Bot added the CICD Run CI/CD label Aug 3, 2026
@github-actions github-actions Bot added the engine flutter/engine related. See also e: labels. label Aug 3, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request migrates native callbacks in shell unit tests and benchmarks from the legacy Dart native API to Dart FFI, updating Dart fixtures to use @Native annotations and C++ tests to use AddFfiNativeCallback with a new CREATE_FFI_LAMBDA helper. The review feedback highlights several improvement opportunities, including documenting lambda capture limitations in CREATE_FFI_LAMBDA to prevent memory leaks, adding a template specialization for mutable lambdas to avoid compilation failures, removing unused exception variables, and replacing legacy Dart_StringToCString calls with tonic::DartConverter for improved safety and consistency.

Comment thread engine/src/flutter/testing/test_dart_native_resolver.h
Comment thread engine/src/flutter/testing/test_dart_native_resolver.h
Comment thread engine/src/flutter/shell/common/input_events_unittests.cc
Comment thread engine/src/flutter/shell/common/input_events_unittests.cc
Comment thread engine/src/flutter/shell/common/shell_unittests.cc
Comment thread engine/src/flutter/shell/common/shell_unittests.cc Outdated
@jason-simmons
jason-simmons requested a review from b-luk August 3, 2026 20:54
This adds a CREATE_FFI_LAMBDA macro that can be used to register a
lambda as a Dart FFI function (similar to how CREATE_NATIVE_ENTRY
works for the old native function API).

The native functions also had to be ported from the
Dart_NativeArguments API to FFI-style function signatures.

See flutter#190154
@jason-simmons jason-simmons added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Aug 5, 2026
Merged via the queue into flutter:master with commit 80cabc3 Aug 5, 2026
22 checks passed
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Aug 5, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Aug 10, 2026
…12420)

Manual roll requested by stuartmorgan@google.com

flutter/flutter@b766512...27b0988

2026-08-05 kevmoo@users.noreply.github.com reland(tool): remove redundant --enable-experiment=record-use flag (flutter/flutter#190591)
2026-08-05 chris@bracken.jp Windows: Propagate enabled accessibility state (flutter/flutter#190507)
2026-08-05 engine-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from ltbuIH9Z3T_yOuigu... to vcANVO8VIDQHasH1X... (flutter/flutter#190589)
2026-08-05 256906086+mvincentong@users.noreply.github.com Document frozen embedder API structs (flutter/flutter#186842)
2026-08-05 49402500+fahaddoc@users.noreply.github.com Document super call order for State.didChangeDependencies (flutter/flutter#185945)
2026-08-05 dkwingsmt@users.noreply.github.com Move examples of `flutter/widgets` widgets out from `flutter/material` (flutter/flutter#189532)
2026-08-05 93888664+ColeSpringer@users.noreply.github.com [web] Use thread local strike caches in skwasm (flutter/flutter#190048)
2026-08-05 43089218+chika3742@users.noreply.github.com doc: fix typo in see also section for PrimaryScrollController.maybeOf (flutter/flutter#190386)
2026-08-05 jason-simmons@users.noreply.github.com Migrate the shell unit tests from legacy Dart native functions to FFI (flutter/flutter#190473)
2026-08-05 47866232+chunhtai@users.noreply.github.com render proxy box now defaults baseline calculation to null (flutter/flutter#190269)
2026-08-05 36861262+QuncCccccc@users.noreply.github.com Update Widgets Localizations from Translation Console (flutter/flutter#190503)
2026-08-04 154381524+flutteractionsbot@users.noreply.github.com Revert: fix(tool): remove redundant --enable-experiment=record-use flag (flutter/flutter#190583)
2026-08-04 engine-flutter-autoroll@skia.org Roll Fuchsia Test Scripts from 1frGe_KltAJKkeyPg... to ltbuIH9Z3T_yOuigu... (flutter/flutter#190561)
2026-08-04 chris@bracken.jp iOS,macOS: add tsan and ubsan support for Swift (flutter/flutter#190497)
2026-08-04 34465683+rkishan516@users.noreply.github.com fix: update on_message_ to nullptr after window destroy so that dart gets destroy message  (flutter/flutter#185807)
2026-08-04 bkonyi@google.com [flutter_tools] Gracefully handle locked Windows files during clean (flutter/flutter#190095)
2026-08-04 chris@bracken.jp iOS,macOS: make Logger thread-safe, conform to Sendable (flutter/flutter#190488)
2026-08-04 chris@bracken.jp iOS: Eliminate use of IOSContextNoop in platform view tests (reland) (flutter/flutter#190509)
2026-08-04 kevmoo@users.noreply.github.com fix(tool): remove redundant --enable-experiment=record-use flag (flutter/flutter#190475)
2026-08-04 awolff@google.com android_hardware_smoke_test: Detect blank image failures or EGL initialization warnings and retry (flutter/flutter#190110)
2026-08-04 30870216+gaaclarke@users.noreply.github.com Bumps text gamma on windows to match skia. (flutter/flutter#190477)
2026-08-04 engine-flutter-autoroll@skia.org Roll Skia from 48b58ee222f1 to a8583a0a2c11 (2 revisions) (flutter/flutter#190537)
2026-08-04 kevmoo@users.noreply.github.com [tool][web] Intercept dart2wasm errors & append JS migration footers (flutter/flutter#190476)
2026-08-04 dacoharkes@google.com [record_use] Migrate IconTreeShaker to `package:record_use` (flutter/flutter#190225)
2026-08-04 s4bre.py@gmail.com Handle unexpected exceptions during Azure metadata detection (flutter/flutter#189457)
2026-08-04 15619084+vashworth@users.noreply.github.com Fix merge conflict from flutter/flutter#190369 (flutter/flutter#190544)
2026-08-04 15619084+vashworth@users.noreply.github.com Prepare device support symbols (flutter/flutter#190369)
2026-08-04 engine-flutter-autoroll@skia.org Roll Packages from ac87e65 to 3498b9d (1 revision) (flutter/flutter#190532)
2026-08-04 engine-flutter-autoroll@skia.org Roll Skia from a08d918ebd6a to 48b58ee222f1 (11 revisions) (flutter/flutter#190527)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC stuartmorgan@google.com,tarrinneal@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants