summaryrefslogtreecommitdiffstats
path: root/libs/hwui/PathCache.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/PathCache.h')
-rw-r--r--libs/hwui/PathCache.h39
1 files changed, 21 insertions, 18 deletions
diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h
index 1d28ecb..27031a5 100644
--- a/libs/hwui/PathCache.h
+++ b/libs/hwui/PathCache.h
@@ -23,6 +23,8 @@
#include "Debug.h"
#include "ShapeCache.h"
#include "thread/Signal.h"
+#include "thread/Task.h"
+#include "thread/TaskProcessor.h"
class SkPaint;
class SkPath;
@@ -100,32 +102,33 @@ public:
void precache(SkPath* path, SkPaint* paint);
private:
- class PrecacheThread: public Thread {
+ class PathTask: public Task<SkBitmap*> {
public:
- PrecacheThread(): mSignal(Condition::WAKE_UP_ONE) { }
+ PathTask(SkPath* path, SkPaint* paint, PathTexture* texture):
+ path(path), paint(paint), texture(texture) {
+ }
- void addTask(PathTexture* texture, SkPath* path, SkPaint* paint);
- void exit();
+ ~PathTask() {
+ delete future()->get();
+ }
- private:
- struct Task {
- PathTexture* texture;
- SkPath* path;
- SkPaint* paint;
- };
+ SkPath* path;
+ SkPaint* paint;
+ PathTexture* texture;
+ };
- virtual bool threadLoop();
+ class PathProcessor: public TaskProcessor<SkBitmap*> {
+ public:
+ PathProcessor(Caches& caches);
+ ~PathProcessor() { }
- // Lock for the list of tasks
- Mutex mLock;
- Vector<Task> mTasks;
+ virtual void onProcess(const sp<Task<SkBitmap*> >& task);
- // Signal used to wake up the thread when a new
- // task is available in the list
- mutable Signal mSignal;
+ private:
+ uint32_t mMaxTextureSize;
};
- sp<PrecacheThread> mThread;
+ sp<PathProcessor> mProcessor;
Vector<SkPath*> mGarbage;
mutable Mutex mLock;
}; // class PathCache