From a35778c799e8073a42b9e22191bde9d838327ab7 Mon Sep 17 00:00:00 2001 From: John Reck Date: Thu, 6 Nov 2014 09:45:10 -0800 Subject: Yank ResourceCache out of Caches Bug: 17947547 Pull the ResourceCache (aka, ref-counting side channel) out of Caches so that DisplayListRenderer doesn't use Caches, avoiding the risk of instantiating Caches on the wrong thread or without a GL context Change-Id: I7d63b70b3b0a0163308c5dedd6ef255eadebe8fd --- libs/hwui/RenderNode.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'libs/hwui/RenderNode.cpp') diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index c9ed9a7d780b..13c54993a6e4 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -98,9 +98,6 @@ void RenderNode::setStagingDisplayList(DisplayListData* data) { mNeedsDisplayListDataSync = true; delete mStagingDisplayListData; mStagingDisplayListData = data; - if (mStagingDisplayListData) { - Caches::getInstance().registerFunctors(mStagingDisplayListData->functors.size()); - } } /** @@ -305,6 +302,10 @@ void RenderNode::pushStagingDisplayListChanges(TreeInfo& info) { // 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) { @@ -321,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; -- cgit v1.2.3-59-g8ed1b