summaryrefslogtreecommitdiffstats
path: root/libs
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-11-06 13:04:49 -0800
committerJohn Reck <jreck@google.com>2014-11-06 13:04:49 -0800
commit088c514cb13f3b8f8683588c2f398f18df1547c9 (patch)
tree798905e133994e16fc1b66a8e6aedeab0eb98872 /libs
parent1af72bff509bb2638c2d7a1309dbf3f03736e6fd (diff)
parentbe70c7713df98d81e9e43af9e76e0e6d018a4339 (diff)
downloadframeworks_base-088c514cb13f3b8f8683588c2f398f18df1547c9.zip
frameworks_base-088c514cb13f3b8f8683588c2f398f18df1547c9.tar.gz
frameworks_base-088c514cb13f3b8f8683588c2f398f18df1547c9.tar.bz2
resolved conflicts for merge of be70c771 to master
Change-Id: I469905bef7361c18aab725778694567d1987c06d
Diffstat (limited to 'libs')
-rw-r--r--libs/hwui/Caches.h1
-rw-r--r--libs/hwui/DisplayList.cpp17
-rw-r--r--libs/hwui/DisplayListRenderer.cpp4
-rw-r--r--libs/hwui/DisplayListRenderer.h11
-rw-r--r--libs/hwui/RenderNode.cpp10
-rw-r--r--libs/hwui/ResourceCache.cpp6
-rw-r--r--libs/hwui/ResourceCache.h8
7 files changed, 35 insertions, 22 deletions
diff --git a/libs/hwui/Caches.h b/libs/hwui/Caches.h
index 7bb5c4a..4b8b626 100644
--- a/libs/hwui/Caches.h
+++ b/libs/hwui/Caches.h
@@ -342,7 +342,6 @@ public:
TessellationCache tessellationCache;
TextDropShadowCache dropShadowCache;
FboCache fboCache;
- ResourceCache resourceCache;
GammaFontRenderer* fontRenderer;
diff --git a/libs/hwui/DisplayList.cpp b/libs/hwui/DisplayList.cpp
index 4a927cf..8953166 100644
--- a/libs/hwui/DisplayList.cpp
+++ b/libs/hwui/DisplayList.cpp
@@ -39,29 +39,28 @@ DisplayListData::~DisplayListData() {
}
void DisplayListData::cleanupResources() {
- Caches& caches = Caches::getInstance();
- caches.unregisterFunctors(functors.size());
- caches.resourceCache.lock();
+ ResourceCache& resourceCache = ResourceCache::getInstance();
+ resourceCache.lock();
for (size_t i = 0; i < bitmapResources.size(); i++) {
- caches.resourceCache.decrementRefcountLocked(bitmapResources.itemAt(i));
+ resourceCache.decrementRefcountLocked(bitmapResources.itemAt(i));
}
for (size_t i = 0; i < ownedBitmapResources.size(); i++) {
const SkBitmap* bitmap = ownedBitmapResources.itemAt(i);
- caches.resourceCache.decrementRefcountLocked(bitmap);
- caches.resourceCache.destructorLocked(bitmap);
+ resourceCache.decrementRefcountLocked(bitmap);
+ resourceCache.destructorLocked(bitmap);
}
for (size_t i = 0; i < patchResources.size(); i++) {
- caches.resourceCache.decrementRefcountLocked(patchResources.itemAt(i));
+ resourceCache.decrementRefcountLocked(patchResources.itemAt(i));
}
for (size_t i = 0; i < sourcePaths.size(); i++) {
- caches.resourceCache.decrementRefcountLocked(sourcePaths.itemAt(i));
+ resourceCache.decrementRefcountLocked(sourcePaths.itemAt(i));
}
- caches.resourceCache.unlock();
+ resourceCache.unlock();
for (size_t i = 0; i < paints.size(); i++) {
delete paints.itemAt(i);
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp
index c0b8a56..639ade7 100644
--- a/libs/hwui/DisplayListRenderer.cpp
+++ b/libs/hwui/DisplayListRenderer.cpp
@@ -21,7 +21,7 @@
#include <private/hwui/DrawGlInfo.h>
-#include "Caches.h"
+#include "ResourceCache.h"
#include "DeferredDisplayList.h"
#include "DisplayListLogBuffer.h"
#include "DisplayListOp.h"
@@ -33,7 +33,7 @@ namespace uirenderer {
DisplayListRenderer::DisplayListRenderer()
: mState(*this)
- , mCaches(Caches::getInstance())
+ , mResourceCache(ResourceCache::getInstance())
, mDisplayListData(NULL)
, mTranslateX(0.0f)
, mTranslateY(0.0f)
diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h
index 7dd788d..7a7af9f 100644
--- a/libs/hwui/DisplayListRenderer.h
+++ b/libs/hwui/DisplayListRenderer.h
@@ -30,6 +30,7 @@
#include "DisplayListLogBuffer.h"
#include "RenderNode.h"
#include "Renderer.h"
+#include "ResourceCache.h"
namespace android {
namespace uirenderer {
@@ -239,7 +240,7 @@ private:
mDisplayListData->paths.add(pathCopy);
}
if (mDisplayListData->sourcePaths.indexOf(path) < 0) {
- mCaches.resourceCache.incrementRefcount(path);
+ mResourceCache.incrementRefcount(path);
mDisplayListData->sourcePaths.add(path);
}
return pathCopy;
@@ -302,19 +303,19 @@ private:
// contents, and drawing again. The only fix would be to always copy it the first time,
// which doesn't seem worth the extra cycles for this unlikely case.
mDisplayListData->bitmapResources.add(bitmap);
- mCaches.resourceCache.incrementRefcount(bitmap);
+ mResourceCache.incrementRefcount(bitmap);
return bitmap;
}
inline const SkBitmap* refBitmapData(const SkBitmap* bitmap) {
mDisplayListData->ownedBitmapResources.add(bitmap);
- mCaches.resourceCache.incrementRefcount(bitmap);
+ mResourceCache.incrementRefcount(bitmap);
return bitmap;
}
inline const Res_png_9patch* refPatch(const Res_png_9patch* patch) {
mDisplayListData->patchResources.add(patch);
- mCaches.resourceCache.incrementRefcount(patch);
+ mResourceCache.incrementRefcount(patch);
return patch;
}
@@ -322,7 +323,7 @@ private:
DefaultKeyedVector<const SkPath*, const SkPath*> mPathMap;
DefaultKeyedVector<const SkRegion*, const SkRegion*> mRegionMap;
- Caches& mCaches;
+ ResourceCache& mResourceCache;
DisplayListData* mDisplayListData;
float mTranslateX;
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 55fc99e..e8f2bc0 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -99,9 +99,6 @@ void RenderNode::setStagingDisplayList(DisplayListData* data) {
mNeedsDisplayListDataSync = true;
delete mStagingDisplayListData;
mStagingDisplayListData = data;
- if (mStagingDisplayListData) {
- Caches::getInstance().registerFunctors(mStagingDisplayListData->functors.size());
- }
}
/**
@@ -306,6 +303,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) {
@@ -322,6 +323,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;
diff --git a/libs/hwui/ResourceCache.cpp b/libs/hwui/ResourceCache.cpp
index 329d92f..12d4928 100644
--- a/libs/hwui/ResourceCache.cpp
+++ b/libs/hwui/ResourceCache.cpp
@@ -21,6 +21,12 @@
#include "Caches.h"
namespace android {
+
+#ifdef USE_OPENGL_RENDERER
+using namespace uirenderer;
+ANDROID_SINGLETON_STATIC_INSTANCE(ResourceCache);
+#endif
+
namespace uirenderer {
///////////////////////////////////////////////////////////////////////////////
diff --git a/libs/hwui/ResourceCache.h b/libs/hwui/ResourceCache.h
index edd6331..c6cd7bf 100644
--- a/libs/hwui/ResourceCache.h
+++ b/libs/hwui/ResourceCache.h
@@ -23,6 +23,7 @@
#include <SkPath.h>
#include <utils/KeyedVector.h>
+#include <utils/Singleton.h>
#include <androidfw/ResourceTypes.h>
@@ -54,11 +55,14 @@ public:
ResourceType resourceType;
};
-class ANDROID_API ResourceCache {
-public:
+class ANDROID_API ResourceCache: public Singleton<ResourceCache> {
ResourceCache();
~ResourceCache();
+ friend class Singleton<ResourceCache>;
+
+public:
+
/**
* When using these two methods, make sure to only invoke the *Locked()
* variants of increment/decrementRefcount(), recyle() and destructor()