Skip to content

[pigeon] Use a const for custom type ids for gobject generated files (#156100) - #9306

Merged
auto-submit[bot] merged 1 commit into
flutter:mainfrom
JesseRiemens:pigeon/gobject-custom-class-const-id
Jun 17, 2025
Merged

[pigeon] Use a const for custom type ids for gobject generated files (#156100)#9306
auto-submit[bot] merged 1 commit into
flutter:mainfrom
JesseRiemens:pigeon/gobject-custom-class-const-id

Conversation

@JesseRiemens

Copy link
Copy Markdown
Contributor

Adds a custom type identifier to generated gobject headers for the user. Calling fl_value_new_custom_object is now possible with that constant.

This fixesflutter/flutter#156100

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 23

@JesseRiemens
JesseRiemensforce-pushed the pigeon/gobject-custom-class-const-id branch from 9ef0df9 to b660a0cCompareMay 22, 2025 15:37
@JesseRiemens
JesseRiemensforce-pushed the pigeon/gobject-custom-class-const-id branch 2 times, most recently from 62b41ae to da4196cCompareMay 22, 2025 16:10
Comment threadpackages/pigeon/platform_tests/test_plugin/linux/pigeon/core_tests.gen.h Outdated
@JesseRiemens
JesseRiemensforce-pushed the pigeon/gobject-custom-class-const-id branch 2 times, most recently from 77d7394 to 3947e4eCompareMay 23, 2025 08:41
@JesseRiemens

Copy link
Copy Markdown
ContributorAuthor

The FLValue headers in some places use int, and in some places use uint8_t:

// fl_value.h:303FlValue*fl_value_new_custom(inttype, // uses intgconstpointervalue,
GDestroyNotifydestroy_notify);
// fl_standard_message_codec.h:148gbooleanfl_standard_message_codec_write_value(FlStandardMessageCodec*codec,
GByteArray*buffer, // uses GByteArray*, which is used (subclassed) in generated files:FlValue*value,
GError**error);
// core_tests.gen.cc:2422staticgbooleancore_tests_pigeon_test_message_codec_write_core_tests_pigeon_test_an_enum(
FlStandardMessageCodec*codec, GByteArray*buffer, FlValue*value,
GError**error) {
uint8_ttype=core_tests_pigeon_test_an_enum_type_id; // appends uint8_t to bufferg_byte_array_append(buffer, &type, sizeof(uint8_t));
returnfl_standard_message_codec_write_value(codec, buffer, value, error);
}

I think this might be related to #152916. Maybe it is best to leave it as is, and for this PR use int for the types.

@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

The FLValue headers in some places use int, and in some places use uint8_t:

Where is the header using uint8_t for the type? I'm seeing in your snippet:

  • A header declaration that uses int for the type.
  • A header declaration that doesn't have the type at all.
  • A file that's not an engine header.

@JesseRiemens

JesseRiemens commented May 23, 2025

Copy link
Copy Markdown
ContributorAuthor

My mistake, it's not the FlValue header that uses uint8_t, but only the generated code using the engine header.
I did not fully understand how it worked, but now I see that the generated dart code at the other side also uses uint8:

classDartGeneratorextendsStructuredGenerator<InternalDartOptions> {
(...)
voidwriteGeneralCodec() {
(...)
indent.writeln('buffer.putUint8(4);');

dart_generator.dart:432

That makes more sense to me now. I guess that means we can keep it like it is.

@JesseRiemens
JesseRiemensforce-pushed the pigeon/gobject-custom-class-const-id branch 4 times, most recently from 7aca7cf to c78a9d9CompareMay 28, 2025 08:22
@JesseRiemens

This comment was marked as off-topic.

@tarrinnealtarrinneal 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.

Pr looks good, just one question and I can lgtm

Comment threadpackages/pigeon/CHANGELOG.md Outdated
@JesseRiemens
JesseRiemensforce-pushed the pigeon/gobject-custom-class-const-id branch from c78a9d9 to 6e4d91eCompareJune 5, 2025 15:09
Comment threadpackages/pigeon/lib/src/gobject/gobject_generator.dart Outdated
Comment threadpackages/pigeon/lib/src/gobject/gobject_generator.dart
Comment threadpackages/pigeon/lib/src/gobject/gobject_generator.dart Outdated
@JesseRiemens
JesseRiemensforce-pushed the pigeon/gobject-custom-class-const-id branch 2 times, most recently from 75a101f to 70c893aCompareJune 6, 2025 12:47
@JesseRiemens

JesseRiemens commented Jun 6, 2025

Copy link
Copy Markdown
ContributorAuthor

If you'd like to compare, this commit contains the changes since the last review

@JesseRiemens
JesseRiemensforce-pushed the pigeon/gobject-custom-class-const-id branch 3 times, most recently from 57edd16 to d5c4bdeCompareJune 10, 2025 15:40
…(#156100)
Adds a custom type identifier to generated gobject headers for the user. Calling fl_value_new_custom_object is now possible with that constant.
This fixesflutter/flutter#156100
Also updated the CONTRIBUTING.md file to include the gobject generator.
@JesseRiemens
JesseRiemensforce-pushed the pigeon/gobject-custom-class-const-id branch from d5c4bde to 2875eafCompareJune 11, 2025 12:29

@stuartmorgan-gstuartmorgan-g left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@stuartmorgan-g

Copy link
Copy Markdown
Collaborator

@tarrinneal This just needs your final re-review.

@tarrinnealtarrinneal 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.

Sorry, thought I'd stamped this already!

@JesseRiemens

Copy link
Copy Markdown
ContributorAuthor

@tarrinneal Can you please autosubmit / merge?

@stuartmorgan-gstuartmorgan-g added the autosubmit Merge PR when tree becomes green via auto submit App label Jun 17, 2025
@auto-submit
auto-submitBot merged commit 8929a93 into flutter:mainJun 17, 2025
@JesseRiemens
JesseRiemens deleted the pigeon/gobject-custom-class-const-id branch June 17, 2025 12:12
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 17, 2025
github-merge-queueBot pushed a commit to flutter/flutter that referenced this pull request Jun 17, 2025
flutter/packages@03a6abb...25d4fa4
2025-06-17 22373191+Hari-07@users.noreply.github.com
[google_maps_flutter] Add a new zIndexInt param to marker and deprecate
zIndex (flutter/packages#8012)
2025-06-17 33691143+JesseRiemens@users.noreply.github.com [pigeon] Use a
const for custom type ids for gobject generated files (#156100)
(flutter/packages#9306)
2025-06-16 22373191+Hari-07@users.noreply.github.com
[google_maps_flutter_platform_(web/android/ios)] Add a new zIndexInt
param to marker and deprecate zIndex (flutter/packages#9408)
2025-06-16 jorgesarpe@gmail.com [camera_avfoundation] fix race condition
when starting image stream on iOS (flutter/packages#8733)
2025-06-16 engine-flutter-autoroll@skia.org Roll Flutter from
f79452e to 8303a96 (21 revisions) (flutter/packages#9433)
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-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.
To file a bug in Flutter:
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
Ortes pushed a commit to Ortes/packages that referenced this pull request Jun 25, 2025
…(#156100) (flutter#9306)
Adds a custom type identifier to generated gobject headers for the user. Calling fl_value_new_custom_object is now possible with that constant.
This fixesflutter/flutter#156100
## Pre-Review Checklist
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
mboetger pushed a commit to mboetger/flutter that referenced this pull request Jul 21, 2025
flutter/packages@03a6abb...25d4fa4
2025-06-17 22373191+Hari-07@users.noreply.github.com
[google_maps_flutter] Add a new zIndexInt param to marker and deprecate
zIndex (flutter/packages#8012)
2025-06-17 33691143+JesseRiemens@users.noreply.github.com [pigeon] Use a
const for custom type ids for gobject generated files (flutter#156100)
(flutter/packages#9306)
2025-06-16 22373191+Hari-07@users.noreply.github.com
[google_maps_flutter_platform_(web/android/ios)] Add a new zIndexInt
param to marker and deprecate zIndex (flutter/packages#9408)
2025-06-16 jorgesarpe@gmail.com [camera_avfoundation] fix race condition
when starting image stream on iOS (flutter/packages#8733)
2025-06-16 engine-flutter-autoroll@skia.org Roll Flutter from
f79452e to 8303a96 (21 revisions) (flutter/packages#9433)
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-flutter-autoroll
Please CC flutter-ecosystem@google.com on the revert to ensure that a
human
is aware of the problem.
To file a bug in Flutter:
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
vashworth pushed a commit to vashworth/packages that referenced this pull request Jul 30, 2025
…(#156100) (flutter#9306)
Adds a custom type identifier to generated gobject headers for the user. Calling fl_value_new_custom_object is now possible with that constant.
This fixesflutter/flutter#156100
## Pre-Review Checklist
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
creatorpiyush pushed a commit to creatorpiyush/packages that referenced this pull request Jun 10, 2026
…(#156100) (flutter#9306)
Adds a custom type identifier to generated gobject headers for the user. Calling fl_value_new_custom_object is now possible with that constant.
This fixesflutter/flutter#156100
## Pre-Review Checklist
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
bisor0627 pushed a commit to bisor0627/packages that referenced this pull request Jun 19, 2026
…(#156100) (flutter#9306)
Adds a custom type identifier to generated gobject headers for the user. Calling fl_value_new_custom_object is now possible with that constant.
This fixesflutter/flutter#156100
## Pre-Review Checklist
[^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmitMerge PR when tree becomes green via auto submit Appp: pigeonplatform-linux

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[pigeon] Expose custom object IDs for testing on Linux

3 participants

@JesseRiemens@stuartmorgan-g@tarrinneal