Change the export logic for the Inspector
Summary: This enables the feature which showed the theme information in the layout plugin. It was disabled due to the OOM which occurred while exporting flipper trace. The OOM happened when we tried to serialise the whole layout hierarchy and the amount of info added per node by the theme info was quite heavy. Thus removing it solved the OOM problem at that point, but its not the correct solution. The problem is that each node has too much information and sending it at one stretch is very heavy and causes OOM. So instead of sending it at one stretch, I have broken it into multiple calls at each level of the tree. This no longer causes OOM and we will be able to show theme information too. Also for iOS we don't have AXNodes call or AXRoot feature implemented, so anyway I had to put a check to not make those calls, so instead I have kept the feature of fetching all nodes on the iOS instead, as there has been no problem on the iOS side with regards to the OOM. But I am indifferent, the same logic will work for iOS too, it might increase the time to export. issue discussed [here](https://fb.workplace.com/groups/flippersupport/permalink/854729375007722/) Reviewed By: jknoxville Differential Revision: D21136057 fbshipit-source-id: becd237a6d53c50af082597f2e8ed790c25cb966
This commit is contained in:
committed by
Facebook GitHub Bot
parent
9d0d900b05
commit
17ccdeaf6f
@@ -51,26 +51,23 @@ public final class ContextDescriptorUtils {
|
||||
|| sThemeImplThemeKeyField == null
|
||||
|| sThemeKeyResIdField == null
|
||||
|| sThemeImplAssetManagerField == null) {
|
||||
sThemeImplField = theme.getClass().getDeclaredField("mThemeImpl");
|
||||
sThemeImplField.setAccessible(true);
|
||||
|
||||
// Early exiting as this bit of code causes too much of the metadata to be created and
|
||||
// ultimately leads to out of memory exception. Reference D20441839
|
||||
// sThemeImplField = theme.getClass().getDeclaredField("mThemeImpl");
|
||||
// sThemeImplField.setAccessible(true);
|
||||
themeImpl = sThemeImplField.get(theme);
|
||||
sThemeImplThemeKeyField = themeImpl.getClass().getDeclaredField("mKey");
|
||||
sThemeImplThemeKeyField.setAccessible(true);
|
||||
|
||||
// themeImpl = sThemeImplField.get(theme);
|
||||
// sThemeImplThemeKeyField = themeImpl.getClass().getDeclaredField("mKey");
|
||||
// sThemeImplThemeKeyField.setAccessible(true);
|
||||
sThemeImplAssetManagerField = themeImpl.getClass().getDeclaredField("mAssets");
|
||||
sThemeImplAssetManagerField.setAccessible(true);
|
||||
|
||||
// sThemeImplAssetManagerField = themeImpl.getClass().getDeclaredField("mAssets");
|
||||
// sThemeImplAssetManagerField.setAccessible(true);
|
||||
sAssetManagerGetStyleAttributesMethod =
|
||||
assetManager.getClass().getDeclaredMethod("getStyleAttributes", int.class);
|
||||
sAssetManagerGetStyleAttributesMethod.setAccessible(true);
|
||||
|
||||
// sAssetManagerGetStyleAttributesMethod =
|
||||
// assetManager.getClass().getDeclaredMethod("getStyleAttributes", int.class);
|
||||
// sAssetManagerGetStyleAttributesMethod.setAccessible(true);
|
||||
|
||||
// themeKey = sThemeImplThemeKeyField.get(themeImpl);
|
||||
// sThemeKeyResIdField = themeKey.getClass().getDeclaredField("mResId");
|
||||
// sThemeKeyResIdField.setAccessible(true);
|
||||
themeKey = sThemeImplThemeKeyField.get(themeImpl);
|
||||
sThemeKeyResIdField = themeKey.getClass().getDeclaredField("mResId");
|
||||
sThemeKeyResIdField.setAccessible(true);
|
||||
|
||||
return builderMap;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user