History log of /frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
776abc24cdd18610232a50b997cce3cffa74609b 07-Mar-2014 Adam Lesinski <adamlesinski@google.com> Uses VMRuntime.newUnpaddedArray for ideal array sizes

Bug:13028925

Change-Id: I0a9301248b10a339afbdc5e4ffe3310ac4fa1fb7
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
88a8364c386c694f7ad56662ef89713dbf7c9d63 27-Jan-2014 Narayan Kamath <narayan@google.com> Track 64bit changes to android/graphics.

All pointers are now 64bits wide, so should be
represented as java longs and not ints.

Also changed DelegateManager and SparseWeakArray to
reflect the new world order.

Change-Id: Ic32b6b53818dbae9b949f03004c4fb6dae26cdbe
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
282e181b58cf72b6ca770dc7ca5f91f135444502 24-Jan-2014 Adam Lesinski <adamlesinski@google.com> Revert "Move frameworks/base/tools/ to frameworks/tools/"

This reverts commit 9f6a119c8aa276432ece4fe2118bd8a3c9b1067e.
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
9f6a119c8aa276432ece4fe2118bd8a3c9b1067e 28-Aug-2013 Mike Lockwood <lockwood@google.com> Move frameworks/base/tools/ to frameworks/tools/

Change-Id: I3ffafdab27cc4aca256c3a5806b630795b75d5c8
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
b2c7dd5986344369f02dfe2965b309153b121127 24-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: downsize the SparseArray when possible.

Change-Id: I570b93ab161414b7729f8d2dce8ddadb706f186b
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
cc4977d0fdaf657907912fd6cc2f9426dc8d2e36 22-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Hold onto delegate references.

When an object is given a delegate to hold onto, keep
the reference to the delegate instead of its native integer.

Also change the way the finalizer works by not explicitely deleting
the delegate. Instead we want the delegate to be deleted when
nothing holds a reference to it. To do this, instead of using
a regular SparseArray, we use a SparseArray of WeakReferences.
Because the main Java object that "owns" the delegate does not
actually holds a reference to the delegate, we fake this by
having the delegate manager hold a reference to delegates for
the main object. This is added/removed as the object is created
and the native finalized is called.

This makes layoutlib behave more like the JNI code where the native
objects are reference counted, and where the Java object can be
deleted but the delegate it owns is kept around (usually because
another type of delegates hold a reference on it.)

To properly handle the WeakReferences, we need to be able to
regularly clear the SparseArray of WeakReference that were
referencing objects that have been GC'ed.
Since the SparseArray is regularly being compacted (actually only
when items are removed), we use a custom SparseWeakArray (started
as a straight copy of SparseArray) that handles the WeakReference
and takes care of compacting the array by removing deleted indices
and WeakReference that returns null. Since our specific use case
doesn't call actually delete() or remove(), the compacting
only happens when the array needs to be resized.

Change-Id: Iacc5c1ff5b21732b8816fda87eb090da12d034e0
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java
8cb6fc184dcb9cc6ab0871de5cf430277d15c8c8 23-Feb-2011 Xavier Ducrohet <xav@android.com> LayoutLib: Import of SparseArray as SparseWeakArray.

This is a straight copy for easy review of the customization.

Change-Id: I351ec570c3e7a025561939ab05c1ae7eded30b38
/frameworks/base/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/util/SparseWeakArray.java