diff options
author | Carl Shapiro <cshapiro@google.com> | 2010-02-24 00:14:23 -0800 |
---|---|---|
committer | Carl Shapiro <cshapiro@google.com> | 2010-02-25 16:42:28 -0800 |
commit | 82fe564267f276151063b2aa0d26075c3210d75f (patch) | |
tree | cd0a77fa4ac1d0c4fc33924d4a9485440ad163b1 /core | |
parent | 4bb79db462a65381e85715da582bdd7fe278fd52 (diff) | |
download | frameworks_base-82fe564267f276151063b2aa0d26075c3210d75f.zip frameworks_base-82fe564267f276151063b2aa0d26075c3210d75f.tar.gz frameworks_base-82fe564267f276151063b2aa0d26075c3210d75f.tar.bz2 |
Comment out the finalize() methods defined on the Activity,
ContextImpl, View and ViewRoot classes. This allows instances of
subclasses to be collected without the additional latency of
finalization.
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/app/Activity.java | 6 | ||||
-rw-r--r-- | core/java/android/app/ContextImpl.java | 6 | ||||
-rw-r--r-- | core/java/android/view/View.java | 6 | ||||
-rw-r--r-- | core/java/android/view/ViewRoot.java | 6 |
4 files changed, 19 insertions, 5 deletions
diff --git a/core/java/android/app/Activity.java b/core/java/android/app/Activity.java index b38aeda..8695598 100644 --- a/core/java/android/app/Activity.java +++ b/core/java/android/app/Activity.java @@ -678,17 +678,19 @@ public class Activity extends ContextThemeWrapper private Thread mUiThread; private final Handler mHandler = new Handler(); + // Used for debug only + /* public Activity() { ++sInstanceCount; } - @Override protected void finalize() throws Throwable { super.finalize(); --sInstanceCount; } - + */ + public static long getInstanceCount() { return sInstanceCount; } diff --git a/core/java/android/app/ContextImpl.java b/core/java/android/app/ContextImpl.java index 0e21936..8335bf3 100644 --- a/core/java/android/app/ContextImpl.java +++ b/core/java/android/app/ContextImpl.java @@ -209,11 +209,14 @@ class ContextImpl extends Context { private static final String[] EMPTY_FILE_LIST = {}; + // For debug only + /* @Override protected void finalize() throws Throwable { super.finalize(); --sInstanceCount; } + */ public static long getInstanceCount() { return sInstanceCount; @@ -1446,7 +1449,8 @@ class ContextImpl extends Context { } ContextImpl() { - ++sInstanceCount; + // For debug only + //++sInstanceCount; mOuterContext = this; } diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 679206d..03b569d 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -1819,7 +1819,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility mContext = context; mResources = context != null ? context.getResources() : null; mViewFlags = SOUND_EFFECTS_ENABLED | HAPTIC_FEEDBACK_ENABLED; - ++sInstanceCount; + // Used for debug only + //++sInstanceCount; mTouchSlop = ViewConfiguration.get(context).getScaledTouchSlop(); } @@ -2133,11 +2134,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility View() { } + // Used for debug only + /* @Override protected void finalize() throws Throwable { super.finalize(); --sInstanceCount; } + */ /** * <p> diff --git a/core/java/android/view/ViewRoot.java b/core/java/android/view/ViewRoot.java index 264b8c9..582ef3f 100644 --- a/core/java/android/view/ViewRoot.java +++ b/core/java/android/view/ViewRoot.java @@ -230,7 +230,8 @@ public final class ViewRoot extends Handler implements ViewParent, lt = new LatencyTimer(100, 1000); } - ++sInstanceCount; + // For debug only + //++sInstanceCount; // Initialize the statics when this class is first instantiated. This is // done here instead of in the static block because Zygote does not @@ -258,11 +259,14 @@ public final class ViewRoot extends Handler implements ViewParent, mDensity = context.getResources().getDisplayMetrics().densityDpi; } + // For debug only + /* @Override protected void finalize() throws Throwable { super.finalize(); --sInstanceCount; } + */ public static long getInstanceCount() { return sInstanceCount; |