Files
react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/YogaNodePool.java
David Vacca ad06403c3e Introduce cloning mechanism for React Shadow Node
Reviewed By: achen1

Differential Revision: D7018869

fbshipit-source-id: beca45b1df9602ebbc9172091b24a2bf44e103f4
2018-02-20 19:09:52 -08:00

29 lines
664 B
Java

// Copyright 2004-present Facebook. All Rights Reserved.
package com.facebook.react.uimanager;
import com.facebook.yoga.YogaNode;
import com.facebook.react.common.ClearableSynchronizedPool;
/**
* Static holder for a recycling pool of YogaNodes.
*/
public class YogaNodePool {
private static final Object sInitLock = new Object();
private static ClearableSynchronizedPool<YogaNode> sPool;
public static ClearableSynchronizedPool<YogaNode> get() {
if (sPool != null) {
return sPool;
}
synchronized (sInitLock) {
if (sPool == null) {
sPool = new ClearableSynchronizedPool<>(1024);
}
return sPool;
}
}
}