Limit the PlatformView ID within the range of 32-bit integers.#121203
Limit the PlatformView ID within the range of 32-bit integers.#121203auto-submit[bot] merged 2 commits intoflutter:masterfrom
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
There was a problem hiding this comment.
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.
Yes, you're right. We can simply use an assertion. :)
ddda02f to
4120b38
Compare
93a6f6d to
628a1fc
Compare
628a1fc to
bc029f1
Compare
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
0x7FFFFFFFplatform 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.