am 94328c30: Merge "Clear bitmap references from display lists as early as possible Bug #6555840" into jb-dev

* commit '94328c308bc8d283841ac6434d47b4c56389a388':
  Clear bitmap references from display lists as early as possible Bug #6555840
This commit is contained in:
Romain Guy
2012-05-24 14:28:22 -07:00
committed by Android Git Automerger
4 changed files with 27 additions and 6 deletions

View File

@@ -82,6 +82,12 @@ public abstract class DisplayList {
*/
public abstract void invalidate();
/**
* Clears additional resources held onto by this display list. You should
* only invoke this method after {@link #invalidate()}.
*/
public abstract void clear();
/**
* Returns whether the display list is currently usable. If this returns false,
* the display list should be re-recorded prior to replaying it.

View File

@@ -71,6 +71,13 @@ class GLES20DisplayList extends DisplayList {
mValid = false;
}
@Override
public void clear() {
if (!mValid) {
mBitmaps.clear();
}
}
@Override
public boolean isValid() {
return mValid;
@@ -343,7 +350,6 @@ class GLES20DisplayList extends DisplayList {
private static native void nSetPivotX(int displayList, float pivotX);
private static native void nSetCaching(int displayList, boolean caching);
private static native void nSetClipChildren(int displayList, boolean clipChildren);
private static native void nSetApplicationScale(int displayList, float scale);
private static native void nSetAlpha(int displayList, float alpha);
private static native void nSetHasOverlappingRendering(int displayList,
boolean hasOverlappingRendering);

View File

@@ -6800,6 +6800,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
*/
public void dispatchStartTemporaryDetach() {
clearAccessibilityFocus();
clearDisplayList();
onStartTemporaryDetach();
}
@@ -11455,10 +11457,8 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
}
mAttachInfo.mViewRootImpl.cancelInvalidate(this);
} else {
if (mDisplayList != null) {
// Should never happen
mDisplayList.invalidate();
}
// Should never happen
clearDisplayList();
}
mCurrentAnimation = null;
@@ -12236,6 +12236,13 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
return mDisplayList;
}
private void clearDisplayList() {
if (mDisplayList != null) {
mDisplayList.invalidate();
mDisplayList.clear();
}
}
/**
* <p>Calling this method is equivalent to calling <code>getDrawingCache(false)</code>.</p>
*

View File

@@ -2335,7 +2335,9 @@ public final class ViewRootImpl implements ViewParent,
final int count = displayLists.size();
for (int i = 0; i < count; i++) {
displayLists.get(i).invalidate();
final DisplayList displayList = displayLists.get(i);
displayList.invalidate();
displayList.clear();
}
displayLists.clear();