Recycle CSSNodes

Summary:
@public

Adds a pool to recycle CSSNodes within UIManager. A follow-up diff will hook this up to a memory pressure listener to drop the pool on memory pressure.

Reviewed By: emilsjolander

Differential Revision: D4189532
This commit is contained in:
Andy Street 2016-11-21 09:11:29 -08:00 committed by Ahmed El-Helw
parent bb8d540cf7
commit 03ac82e387
1 changed files with 6 additions and 4 deletions

View File

@ -363,6 +363,11 @@ public class FlatUIImplementation extends UIImplementation {
* and drops all Views used by it and its children.
*/
private void removeChild(ReactShadowNode child, ReactShadowNode parentNode) {
dropNativeViews(child, parentNode);
removeShadowNode(child);
}
private void dropNativeViews(ReactShadowNode child, ReactShadowNode parentNode) {
if (child instanceof FlatShadowNode) {
FlatShadowNode node = (FlatShadowNode) child;
if (node.mountsToView() && node.isBackingViewCreated()) {
@ -388,16 +393,13 @@ public class FlatUIImplementation extends UIImplementation {
// this will recursively drop all subviews
mStateBuilder.dropView(node, tag);
removeShadowNode(node);
return;
}
}
for (int i = 0, childCount = child.getChildCount(); i != childCount; ++i) {
removeChild(child.getChildAt(i), child);
dropNativeViews(child.getChildAt(i), child);
}
removeShadowNode(child);
}
/**