summaryrefslogtreecommitdiffstats
path: root/core/java/com/android/internal/os/RuntimeInit.java
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2010-08-06 17:58:44 -0700
committerRomain Guy <romainguy@google.com>2010-08-09 09:44:40 -0700
commit02890fd0f98b3b8d98baf0bda1ea906afd723d8b (patch)
tree72779a2551fc4a6c09c4047832d8bf1434213844 /core/java/com/android/internal/os/RuntimeInit.java
parent8576301c38381b0b06c0c804e2d638fabf408f8c (diff)
downloadframeworks_base-02890fd0f98b3b8d98baf0bda1ea906afd723d8b.zip
frameworks_base-02890fd0f98b3b8d98baf0bda1ea906afd723d8b.tar.gz
frameworks_base-02890fd0f98b3b8d98baf0bda1ea906afd723d8b.tar.bz2
Replace Bitmap's finalizers with PhantomReferences.
This change also removes the use of SoftReferences for View's drawing cache. A bitmap now creates a PhantomReference enqueued in a reference queue provided by the new Finalizers class. This queue is polled from a thread started after forking zygote. That thread is in charge of clearing the references after GC runs and of calling reclaim() on them. The reclaim() method is now how finalizers are run. Note that a PhantomReference cannot be kept in the instance it refers to, which is why they are kept in a separate List. Change-Id: If3c1a5e9dc23fa49e34857860d730f5cf5ad5926
Diffstat (limited to 'core/java/com/android/internal/os/RuntimeInit.java')
-rw-r--r--core/java/com/android/internal/os/RuntimeInit.java10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/com/android/internal/os/RuntimeInit.java b/core/java/com/android/internal/os/RuntimeInit.java
index 59600dc..5767832 100644
--- a/core/java/com/android/internal/os/RuntimeInit.java
+++ b/core/java/com/android/internal/os/RuntimeInit.java
@@ -24,6 +24,7 @@ import android.os.IBinder;
import android.os.Process;
import android.os.SystemProperties;
import android.util.Config;
+import android.util.Finalizers;
import android.util.Log;
import android.util.Slog;
@@ -141,6 +142,12 @@ public class RuntimeInit {
Debug.enableEmulatorTraceOutput();
}
+ /**
+ * Initialize the thread used to reclaim resources without
+ * going through finalizers.
+ */
+ Finalizers.init();
+
initialized = true;
}
@@ -331,9 +338,6 @@ public class RuntimeInit {
}
}
- /** Counter used to prevent reentrancy in {@link #reportException}. */
- private static final AtomicInteger sInReportException = new AtomicInteger();
-
/**
* Set the object identifying this application/process, for reporting VM
* errors.