Subtle stopSurface lifecycle change

Summary:
Change lifecycle of stopSurface in a subtle way: mark the surface as stopped in Java first, then in Cxx (currently it happens in Cxx, then Java).

This will cause us / allow us to ignore the final mounting instructions for the Surface, which are all irrelevant since they just have to do with View removal.
We can rely on GC and `unmountReactApplication` to do all of this for us, and save some CPU cycles on stopSurface.

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D26469741

fbshipit-source-id: a7f81d44c3cb2138f0ab31feb38852910410c638
This commit is contained in:
Joshua Gross 2021-02-16 14:45:57 -08:00 коммит произвёл Facebook GitHub Bot
Родитель 3357341347
Коммит e810291790
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -280,8 +280,13 @@ public class FabricUIManager implements UIManager, LifecycleEventListener {
@ThreadConfined(ANY)
@Override
public void stopSurface(final int surfaceID) {
mBinding.stopSurface(surfaceID);
// Mark surfaceId as dead, stop executing mounting instructions
mMountingManager.stopSurface(surfaceID);
// Communicate stopSurface to Cxx - causes an empty ShadowTree to be committed,
// but all mounting instructions will be ignored because stopSurface was called
// on the MountingManager
mBinding.stopSurface(surfaceID);
}
@Override