diff options
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
-rw-r--r-- | libs/hwui/RenderNode.cpp | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 254492f..13c5499 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -50,10 +50,13 @@ void RenderNode::outputLogBuffer(int fd) { fprintf(file, "\nRecent DisplayList operations\n"); logBuffer.outputCommands(file); - String8 cachesLog; - Caches::getInstance().dumpMemoryUsage(cachesLog); - fprintf(file, "\nCaches:\n%s", cachesLog.string()); - fprintf(file, "\n"); + if (Caches::hasInstance()) { + String8 cachesLog; + Caches::getInstance().dumpMemoryUsage(cachesLog); + fprintf(file, "\nCaches:\n%s\n", cachesLog.string()); + } else { + fprintf(file, "\nNo caches instance.\n"); + } fflush(file); } @@ -84,16 +87,17 @@ RenderNode::RenderNode() RenderNode::~RenderNode() { deleteDisplayListData(); delete mStagingDisplayListData; - LayerRenderer::destroyLayerDeferred(mLayer); + if (mLayer) { + ALOGW("Memory Warning: Layer %p missed its detachment, held on to for far too long!", mLayer); + mLayer->postDecStrong(); + mLayer = 0; + } } void RenderNode::setStagingDisplayList(DisplayListData* data) { mNeedsDisplayListDataSync = true; delete mStagingDisplayListData; mStagingDisplayListData = data; - if (mStagingDisplayListData) { - Caches::getInstance().registerFunctors(mStagingDisplayListData->functors.size()); - } } /** @@ -198,6 +202,7 @@ void RenderNode::pushLayerUpdate(TreeInfo& info) { info.damageAccumulator->peekAtDirty(&dirty); if (!mLayer) { + Caches::getInstance().dumpMemoryUsage(); if (info.errorHandler) { std::string msg = "Unable to create layer for "; msg += getName(); @@ -293,7 +298,14 @@ void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) { mStagingDisplayListData->children()[i]->mRenderNode->incParentRefCount(); } } + // Damage with the old display list first then the new one to catch any + // changes in isRenderable or, in the future, bounds + damageSelf(info); deleteDisplayListData(); + // TODO: Remove this caches stuff + if (mStagingDisplayListData && mStagingDisplayListData->functors.size()) { + Caches::getInstance().registerFunctors(mStagingDisplayListData->functors.size()); + } mDisplayListData = mStagingDisplayListData; mStagingDisplayListData = NULL; if (mDisplayListData) { @@ -310,6 +322,9 @@ void RenderNode::deleteDisplayListData() { for (size_t i = 0; i < mDisplayListData->children().size(); i++) { mDisplayListData->children()[i]->mRenderNode->decParentRefCount(); } + if (mDisplayListData->functors.size()) { + Caches::getInstance().unregisterFunctors(mDisplayListData->functors.size()); + } } delete mDisplayListData; mDisplayListData = NULL; |