mirror of
https://github.com/status-im/react-native.git
synced 2025-01-29 18:54:58 +00:00
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:
parent
bb8d540cf7
commit
03ac82e387
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user