Loading libs/hwui/Caches.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -310,6 +310,7 @@ void Caches::flush(FlushMode mode) { fontRenderer->flush(); textureCache.flush(); pathCache.clear(); tasks.stop(); // fall through case kFlushMode_Layers: layerCache.clear(); Loading libs/hwui/PathCache.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -347,14 +347,15 @@ void PathCache::PathProcessor::onProcess(const sp<Task<SkBitmap*> >& task) { // Paths /////////////////////////////////////////////////////////////////////////////// void PathCache::remove(SkPath* path) { void PathCache::remove(const path_pair_t& pair) { Vector<PathDescription> pathsToRemove; LruCache<PathDescription, PathTexture*>::Iterator i(mCache); while (i.next()) { const PathDescription& key = i.key(); if (key.type == kShapePath && (key.shape.path.mPath == path || key.shape.path.mPath == path->getSourcePath())) { (key.shape.path.mPath == pair.getFirst() || key.shape.path.mPath == pair.getSecond())) { pathsToRemove.push(key); } } Loading @@ -366,7 +367,7 @@ void PathCache::remove(SkPath* path) { void PathCache::removeDeferred(SkPath* path) { Mutex::Autolock l(mLock); mGarbage.push(path); mGarbage.push(path_pair_t(path, const_cast<SkPath*>(path->getSourcePath()))); } void PathCache::clearGarbage() { Loading libs/hwui/PathCache.h +11 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include "Debug.h" #include "Properties.h" #include "Texture.h" #include "utils/Pair.h" class SkBitmap; class SkCanvas; Loading Loading @@ -214,10 +215,6 @@ public: bool useCenter, SkPaint* paint); PathTexture* get(SkPath* path, SkPaint* paint); /** * Removes an entry. */ void remove(SkPath* path); /** * Removes the specified path. This is meant to be called from threads * that are not the EGL context thread. Loading Loading @@ -251,6 +248,8 @@ public: float& left, float& top, float& offset, uint32_t& width, uint32_t& height); private: typedef Pair<SkPath*, SkPath*> path_pair_t; PathTexture* addTexture(const PathDescription& entry, const SkPath *path, const SkPaint* paint); PathTexture* addTexture(const PathDescription& entry, SkBitmap* bitmap); Loading @@ -260,6 +259,12 @@ private: return mCache.get(entry); } /** * Removes an entry. * The pair must define first=path, second=sourcePath */ void remove(const path_pair_t& pair); /** * Ensures there is enough space in the cache for a texture of the specified * dimensions. Loading Loading @@ -318,7 +323,8 @@ private: bool mDebugEnabled; sp<PathProcessor> mProcessor; Vector<SkPath*> mGarbage; Vector<path_pair_t> mGarbage; mutable Mutex mLock; }; // class PathCache Loading libs/hwui/thread/TaskManager.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,12 @@ bool TaskManager::canRunTasks() const { return mThreads.size() > 0; } void TaskManager::stop() { for (size_t i = 0; i < mThreads.size(); i++) { mThreads[i]->exit(); } } bool TaskManager::addTaskBase(const sp<TaskBase>& task, const sp<TaskProcessorBase>& processor) { if (mThreads.size() > 0) { TaskWrapper wrapper(task, processor); Loading libs/hwui/thread/TaskManager.h +6 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,12 @@ public: */ bool canRunTasks() const; /** * Stops all allocated threads. Adding tasks will start * the threads again as necessary. */ void stop(); private: template <typename T> friend class TaskProcessor; Loading Loading
libs/hwui/Caches.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -310,6 +310,7 @@ void Caches::flush(FlushMode mode) { fontRenderer->flush(); textureCache.flush(); pathCache.clear(); tasks.stop(); // fall through case kFlushMode_Layers: layerCache.clear(); Loading
libs/hwui/PathCache.cpp +4 −3 Original line number Diff line number Diff line Loading @@ -347,14 +347,15 @@ void PathCache::PathProcessor::onProcess(const sp<Task<SkBitmap*> >& task) { // Paths /////////////////////////////////////////////////////////////////////////////// void PathCache::remove(SkPath* path) { void PathCache::remove(const path_pair_t& pair) { Vector<PathDescription> pathsToRemove; LruCache<PathDescription, PathTexture*>::Iterator i(mCache); while (i.next()) { const PathDescription& key = i.key(); if (key.type == kShapePath && (key.shape.path.mPath == path || key.shape.path.mPath == path->getSourcePath())) { (key.shape.path.mPath == pair.getFirst() || key.shape.path.mPath == pair.getSecond())) { pathsToRemove.push(key); } } Loading @@ -366,7 +367,7 @@ void PathCache::remove(SkPath* path) { void PathCache::removeDeferred(SkPath* path) { Mutex::Autolock l(mLock); mGarbage.push(path); mGarbage.push(path_pair_t(path, const_cast<SkPath*>(path->getSourcePath()))); } void PathCache::clearGarbage() { Loading
libs/hwui/PathCache.h +11 −5 Original line number Diff line number Diff line Loading @@ -26,6 +26,7 @@ #include "Debug.h" #include "Properties.h" #include "Texture.h" #include "utils/Pair.h" class SkBitmap; class SkCanvas; Loading Loading @@ -214,10 +215,6 @@ public: bool useCenter, SkPaint* paint); PathTexture* get(SkPath* path, SkPaint* paint); /** * Removes an entry. */ void remove(SkPath* path); /** * Removes the specified path. This is meant to be called from threads * that are not the EGL context thread. Loading Loading @@ -251,6 +248,8 @@ public: float& left, float& top, float& offset, uint32_t& width, uint32_t& height); private: typedef Pair<SkPath*, SkPath*> path_pair_t; PathTexture* addTexture(const PathDescription& entry, const SkPath *path, const SkPaint* paint); PathTexture* addTexture(const PathDescription& entry, SkBitmap* bitmap); Loading @@ -260,6 +259,12 @@ private: return mCache.get(entry); } /** * Removes an entry. * The pair must define first=path, second=sourcePath */ void remove(const path_pair_t& pair); /** * Ensures there is enough space in the cache for a texture of the specified * dimensions. Loading Loading @@ -318,7 +323,8 @@ private: bool mDebugEnabled; sp<PathProcessor> mProcessor; Vector<SkPath*> mGarbage; Vector<path_pair_t> mGarbage; mutable Mutex mLock; }; // class PathCache Loading
libs/hwui/thread/TaskManager.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,12 @@ bool TaskManager::canRunTasks() const { return mThreads.size() > 0; } void TaskManager::stop() { for (size_t i = 0; i < mThreads.size(); i++) { mThreads[i]->exit(); } } bool TaskManager::addTaskBase(const sp<TaskBase>& task, const sp<TaskProcessorBase>& processor) { if (mThreads.size() > 0) { TaskWrapper wrapper(task, processor); Loading
libs/hwui/thread/TaskManager.h +6 −0 Original line number Diff line number Diff line Loading @@ -47,6 +47,12 @@ public: */ bool canRunTasks() const; /** * Stops all allocated threads. Adding tasks will start * the threads again as necessary. */ void stop(); private: template <typename T> friend class TaskProcessor; Loading