Loading tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java +6 −6 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ import android.util.SparseArray; import java.io.PrintStream; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import java.util.HashSet; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; /** Loading @@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLong; * * This is used in conjunction with layoublib_create: certain Android java classes are mere * wrappers around a heavily native based implementation, and we need a way to run these classes * in our Eclipse rendering framework without bringing all the native code from the Android * in our Android Studio rendering framework without bringing all the native code from the Android * platform. * * Thus we instruct layoutlib_create to modify the bytecode of these classes to replace their Loading Loading @@ -61,7 +61,7 @@ import java.util.concurrent.atomic.AtomicLong; * following mechanism: * * - {@link #addNewDelegate(Object)} and {@link #removeJavaReferenceFor(long)} adds and removes * the delegate to/from a list. This list hold the reference and prevents the GC from reclaiming * the delegate to/from a set. This set holds the reference and prevents the GC from reclaiming * the delegate. * * - {@link #addNewDelegate(Object)} also adds the delegate to a {@link SparseArray} that holds a Loading @@ -76,12 +76,12 @@ public final class DelegateManager<T> { @SuppressWarnings("FieldCanBeLocal") private final Class<T> mClass; private static final SparseWeakArray<Object> sDelegates = new SparseWeakArray<>(); /** list used to store delegates when their main object holds a reference to them. /** Set used to store delegates when their main object holds a reference to them. * This is to ensure that the WeakReference in the SparseWeakArray doesn't get GC'ed * @see #addNewDelegate(Object) * @see #removeJavaReferenceFor(long) */ private static final List<Object> sJavaReferences = new ArrayList<>(); private static final Set<Object> sJavaReferences = new HashSet<>(); private static final AtomicLong sDelegateCounter = new AtomicLong(1); public DelegateManager(Class<T> theClass) { Loading Loading
tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/DelegateManager.java +6 −6 Original line number Diff line number Diff line Loading @@ -24,8 +24,8 @@ import android.util.SparseArray; import java.io.PrintStream; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.List; import java.util.HashSet; import java.util.Set; import java.util.concurrent.atomic.AtomicLong; /** Loading @@ -33,7 +33,7 @@ import java.util.concurrent.atomic.AtomicLong; * * This is used in conjunction with layoublib_create: certain Android java classes are mere * wrappers around a heavily native based implementation, and we need a way to run these classes * in our Eclipse rendering framework without bringing all the native code from the Android * in our Android Studio rendering framework without bringing all the native code from the Android * platform. * * Thus we instruct layoutlib_create to modify the bytecode of these classes to replace their Loading Loading @@ -61,7 +61,7 @@ import java.util.concurrent.atomic.AtomicLong; * following mechanism: * * - {@link #addNewDelegate(Object)} and {@link #removeJavaReferenceFor(long)} adds and removes * the delegate to/from a list. This list hold the reference and prevents the GC from reclaiming * the delegate to/from a set. This set holds the reference and prevents the GC from reclaiming * the delegate. * * - {@link #addNewDelegate(Object)} also adds the delegate to a {@link SparseArray} that holds a Loading @@ -76,12 +76,12 @@ public final class DelegateManager<T> { @SuppressWarnings("FieldCanBeLocal") private final Class<T> mClass; private static final SparseWeakArray<Object> sDelegates = new SparseWeakArray<>(); /** list used to store delegates when their main object holds a reference to them. /** Set used to store delegates when their main object holds a reference to them. * This is to ensure that the WeakReference in the SparseWeakArray doesn't get GC'ed * @see #addNewDelegate(Object) * @see #removeJavaReferenceFor(long) */ private static final List<Object> sJavaReferences = new ArrayList<>(); private static final Set<Object> sJavaReferences = new HashSet<>(); private static final AtomicLong sDelegateCounter = new AtomicLong(1); public DelegateManager(Class<T> theClass) { Loading