-
Notifications
You must be signed in to change notification settings - Fork 28.7k
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
Conversation
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. |
7fd0fcb
to
18405c7
Compare
// 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. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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. :)
ddda02f
to
4120b38
Compare
93a6f6d
to
628a1fc
Compare
628a1fc
to
bc029f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.