summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-07-07 16:30:41 -0700
committerJohn Reck <jreck@google.com>2014-07-07 23:37:40 +0000
commitec0c92548071801c81e02ca72b9864739e1c080c (patch)
tree829bbba8e3351d5cce26e477111fa424549c2431
parenteb2263dd72ed40b47337fcd12189a4f268584b8b (diff)
downloadframeworks_base-ec0c92548071801c81e02ca72b9864739e1c080c.zip
frameworks_base-ec0c92548071801c81e02ca72b9864739e1c080c.tar.gz
frameworks_base-ec0c92548071801c81e02ca72b9864739e1c080c.tar.bz2
Fix destroyHardwareResources
The UI thread needs to know whether or not the display list is valid, so bring back View.destroyHardwareResources and instead have the native side assert that View did the right thing Change-Id: I4f8dee6e9c13ec7ab520becdc5cfe20e92a76f8f
-rw-r--r--core/java/android/view/ThreadedRenderer.java2
-rw-r--r--core/java/android/view/View.java4
-rw-r--r--libs/hwui/RenderNode.cpp9
3 files changed, 10 insertions, 5 deletions
diff --git a/core/java/android/view/ThreadedRenderer.java b/core/java/android/view/ThreadedRenderer.java
index 57d1beb..fa4564e 100644
--- a/core/java/android/view/ThreadedRenderer.java
+++ b/core/java/android/view/ThreadedRenderer.java
@@ -127,6 +127,8 @@ public class ThreadedRenderer extends HardwareRenderer {
@Override
void destroyHardwareResources(View view) {
destroyResources(view);
+ // mRootNode belongs to us and not a view, so we need to destroy it
+ mRootNode.destroyDisplayListData();
nDestroyHardwareResources(mNativeProxy);
}
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
index 3b2e1d1..0ee9e06 100644
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -13625,9 +13625,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
* @hide
*/
protected void destroyHardwareResources() {
- // Intentionally empty. RenderNode's lifecycle is now fully managed
- // by the hardware renderer.
- // However some subclasses (eg, WebView, TextureView) still need this signal
+ resetDisplayList();
}
/**
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 89105ea..3cf625f 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -211,7 +211,8 @@ void RenderNode::prepareTreeImpl(TreeInfo& info) {
// This will also release the hardware layer if we have one as
// isRenderable() will return false, thus causing pushLayerUpdate
// to recycle the hardware layer
- setStagingDisplayList(NULL);
+ LOG_ALWAYS_FATAL_IF(mStagingDisplayListData || (mDisplayListData && !mNeedsDisplayListDataSync),
+ "View.destroyHardwareResources wasn't called!");
break;
}
@@ -260,7 +261,11 @@ void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) {
mNeedsDisplayListDataSync = false;
// Do a push pass on the old tree to handle freeing DisplayListData
// that are no longer used
- TreeInfo oldTreeInfo(TreeInfo::MODE_MAYBE_DETACHING, info);
+ TreeInfo::TraversalMode mode = TreeInfo::MODE_MAYBE_DETACHING;
+ if (CC_UNLIKELY(info.mode == TreeInfo::MODE_DESTROY_RESOURCES)) {
+ mode = TreeInfo::MODE_DESTROY_RESOURCES;
+ }
+ TreeInfo oldTreeInfo(mode, info);
prepareSubTree(oldTreeInfo, mDisplayListData);
delete mDisplayListData;
mDisplayListData = mStagingDisplayListData;