-
Notifications
You must be signed in to change notification settings - Fork 6k
Fix issue about multi-engine loading assets throws exception after engines restart #34473
Fix issue about multi-engine loading assets throws exception after engines restart #34473
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. |
|
(Unittest added) |
|
This seems reasonable to me, tagging Jason and Gary to take a look as well. |
…after engines restart (flutter/engine#34473)
|
@jiahaog this might be what you're seeing in your memory tests? The results did look unexpected to me. |
…after engines restart (flutter#34473)" This reverts commit e6b17e0. Manually resolved the following conflicts: - ci/licenses_golden/licenses_flutter - shell/platform/android/apk_asset_provider.cc - shell/platform/android/apk_asset_provider_unittests.cc
…after engines restart (flutter#34473)" This reverts commit e6b17e0.
fix flutter/flutter#107091
On the Android platform, the current implementation is that multiple lightweight engines share the same
AssetManager, and the relationship between the engine and theAssetManageris Nv1. After engine restart, each engine will regenerate its ownAssetManager, and the relationship between the engine and theAssetManagerbecomes 1v1.Due to the following code, only one of these new AssetManagers will hold the original
APKAssetProvider.https://github.com/flutter/engine/blob/main/shell/common/shell.cc#L1632-L1641
proposed solution
Lightweight engines no longer share
AssetManager, each engine has ownAssetManager, and eachAssetManagerhas anAPKAssetProviderinside.There is an
APKAssetProviderImplinside theAPKAssetProvider, which is used to encapsulate the specific implementation. In a lightweight engine scenario, multipleAPKAssetProviders share the sameAPKAssetProviderImplAPKAssetProviderprovides aClonemethod to create a newAPKAssetProvider, the new provider sharesAPKAssetProviderImplwith the current provider.Pre-launch Checklist
writing and running engine tests.
///).