Skip to content

Limit the PlatformView ID within the range of 32-bit integers. #121203

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 2 commits into from
Feb 27, 2023

Conversation

0xZOne
Copy link
Member

@0xZOne 0xZOne commented Feb 22, 2023

On the Android side, the interface exposed to users uses 32-bit integers. See flutter/engine#39476 (comment) for more details.

We can safely assume that a Flutter application will not require more than 0x7FFFFFFF platform views during its lifetime.

Related issue: #120256

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

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

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Feb 22, 2023
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@0xZOne 0xZOne marked this pull request as draft February 22, 2023 09:45
@0xZOne 0xZOne marked this pull request as ready for review February 22, 2023 09:53
@0xZOne 0xZOne force-pushed the task/limit_view_id branch 4 times, most recently from 7fd0fcb to 18405c7 Compare February 22, 2023 12:39
// See https://github.com/flutter/engine/pull/39476 for more details.

// We can safely assume that a Flutter application will not require more
// than MAX_INT32 platform views on the fly throughout its lifetime.
Copy link
Contributor

@stuartmorgan-g stuartmorgan-g Feb 22, 2023

Choose a reason for hiding this comment

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

This comment is inconsistent with the next comment and the code; if it's safe to assume that we won't need more than MAX_INT32 platform views over the course of the application's lifetime, then we don't need code to do rollover because it'll never be run; we can simply assert.

If what you actually mean is simultaneous views, and you actually want to handle that, this code isn't sufficient; you would actually need to track which views IDs are still active, because just because there's been rollover doesn't mean that every previous ID is gone. If someone cycling through more than a billion platform views is plausible, then it's equally plausible that they do so while still using, say, view number 1.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, you're right. We can simply use an assertion. :)

@0xZOne 0xZOne force-pushed the task/limit_view_id branch from ddda02f to 4120b38 Compare February 23, 2023 02:20
@0xZOne 0xZOne force-pushed the task/limit_view_id branch 2 times, most recently from 93a6f6d to 628a1fc Compare February 24, 2023 11:58
@0xZOne 0xZOne force-pushed the task/limit_view_id branch from 628a1fc to bc029f1 Compare February 27, 2023 01:47
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

@0xZOne 0xZOne added the autosubmit Merge PR when tree becomes green via auto submit App label Feb 27, 2023
@auto-submit auto-submit bot merged commit a5c60f4 into flutter:master Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
@reidbaker reidbaker requested review from reidbaker and removed request for reidbaker February 27, 2023 16:36
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Feb 27, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App framework flutter/packages/flutter repository. See also f: labels.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants