Skip to content

[google_maps_flutter_android] Convert PlatformPolygon and PlatformPolyline to Pigeon #7406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Aug 21, 2024

Conversation

yaakovschectman
Copy link
Contributor

Replace the old JSON-based encoding of polygons and polylines to use structured pigeon type.

flutter/flutter#152926

Pre-launch Checklist

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

@yaakovschectman yaakovschectman marked this pull request as ready for review August 14, 2024 17:10
@@ -862,6 +795,15 @@ static List<LatLng> toPoints(Object o) {
return points;
}

static List<LatLng> toPoints(List<Messages.PlatformLatLng> data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please call this pointsFromPigeon, matching the style of some of the existing methods, so that we don't have two things with the same name, one of which takes Object, because it makes it hard to clearly reason about which one is being called since List<Messages.PlatformLatLng> is also an Object. Having clearly separable codepaths makes the Object versions less of a foot-gun for as long as we have to have them.

final List<List<LatLng>> holes = new ArrayList<>(data.size());

for (Object rawHole : data) {
for (List<Messages.PlatformLatLng> rawHole : data) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Just hole now that this is a typed structure instead of an Object.

final int color;
final bool geodesic;
final int jointType;
// TODO(schectman): convert to structured data.
Copy link
Contributor

Choose a reason for hiding this comment

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

This should have detail about the exact meaning/source of the object, like the old json TODO.

@@ -784,7 +784,7 @@ static String interpretHeatmapOptions(Map<String, ?> data, HeatmapOptionsSink si
}

@VisibleForTesting
static List<LatLng> toPoints(Object o) {
static List<LatLng> pointsFromPigeon(Object o) {
Copy link
Contributor

Choose a reason for hiding this comment

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

You've renamed the non-Pigeon version to say it's for Pigeon. The Pigeon version is the one that takes a List<Messages.PlatformLatLng>.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm, I thought there were still unconverted codepaths that used toPoints, but now that you've changed the names it looks like there aren't; it's marked VisibleForTesting, and there are no references I see within the file. If toPoints is dead code now, it should be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see a reference to it remaining at

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a unit test, not production code.

Copy link
Contributor

@stuartmorgan-g stuartmorgan-g left a comment

Choose a reason for hiding this comment

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

LGTM!

@yaakovschectman yaakovschectman merged commit 50e4138 into flutter:main Aug 21, 2024
76 checks passed
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 22, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Aug 23, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Aug 23, 2024
flutter/packages@c5d03ee...d862279

2024-08-22 jacksongardner@google.com Serve benchmarks with COOP/COEP headers in wasm mode. (flutter/packages#7423)
2024-08-21 109111084+yaakovschectman@users.noreply.github.com [google_maps_flutter_android] Convert `PlatformPolygon` and `PlatformPolyline` to Pigeon (flutter/packages#7406)
2024-08-21 tarrinneal@gmail.com [pigeon] simplifies int handling across the codec, verifies ints in collections (flutter/packages#7392)
2024-08-21 engine-flutter-autoroll@skia.org Roll Flutter (stable) from 80c2e84 to 5874a72 (9 revisions) (flutter/packages#7472)
2024-08-21 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/interactive_media_ads/android (flutter/packages#7384)
2024-08-21 engine-flutter-autoroll@skia.org Roll Flutter from e7da16d to b8f89f7 (28 revisions) (flutter/packages#7471)
2024-08-21 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Adds a contribution doc (flutter/packages#7460)
2024-08-21 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#7373)
2024-08-21 paulberry@google.com [script] Remove unnecessary breaks in default clauses of switch statements (flutter/packages#7469)

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,rmistry@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
Buchimi pushed a commit to Buchimi/flutter that referenced this pull request Sep 2, 2024
flutter/packages@c5d03ee...d862279

2024-08-22 jacksongardner@google.com Serve benchmarks with COOP/COEP headers in wasm mode. (flutter/packages#7423)
2024-08-21 109111084+yaakovschectman@users.noreply.github.com [google_maps_flutter_android] Convert `PlatformPolygon` and `PlatformPolyline` to Pigeon (flutter/packages#7406)
2024-08-21 tarrinneal@gmail.com [pigeon] simplifies int handling across the codec, verifies ints in collections (flutter/packages#7392)
2024-08-21 engine-flutter-autoroll@skia.org Roll Flutter (stable) from 80c2e84 to 5874a72 (9 revisions) (flutter/packages#7472)
2024-08-21 49699333+dependabot[bot]@users.noreply.github.com [interactive_media_ads]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/interactive_media_ads/android (flutter/packages#7384)
2024-08-21 engine-flutter-autoroll@skia.org Roll Flutter from e7da16d to b8f89f7 (28 revisions) (flutter/packages#7471)
2024-08-21 10687576+bparrishMines@users.noreply.github.com [interactive_media_ads] Adds a contribution doc (flutter/packages#7460)
2024-08-21 49699333+dependabot[bot]@users.noreply.github.com [webview]: Bump androidx.annotation:annotation from 1.8.1 to 1.8.2 in /packages/webview_flutter/webview_flutter_android/android (flutter/packages#7373)
2024-08-21 paulberry@google.com [script] Remove unnecessary breaks in default clauses of switch statements (flutter/packages#7469)

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,rmistry@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants