summaryrefslogtreecommitdiff
path: root/libs/hwui/renderthread/CacheManager.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2019-03-14 13:15:28 -0700
committerJohn Reck <jreck@google.com>2019-03-18 09:34:11 -0700
commit322b8ab77462993fb2d84ed08bd93ba238b6b152 (patch)
tree1af6a0d66d6c77c8e93990a3ce7faa7377f6c2fe /libs/hwui/renderthread/CacheManager.cpp
parent59a599c1d34e0d70171672b6fa6bc52b81be3508 (diff)
Remove old TaskManager system
Replace it with a newer, fancier, WorkQueue-inspired one that's just a global common thread pool. Test: hwuiunit passes Change-Id: Ib5d03104a08bbac9a4ec67a1bfc0db2b35d6700f
Diffstat (limited to 'libs/hwui/renderthread/CacheManager.cpp')
-rw-r--r--libs/hwui/renderthread/CacheManager.cpp30
1 files changed, 6 insertions, 24 deletions
diff --git a/libs/hwui/renderthread/CacheManager.cpp b/libs/hwui/renderthread/CacheManager.cpp
index 6c04232ab7f5..8b02c11911ca 100644
--- a/libs/hwui/renderthread/CacheManager.cpp
+++ b/libs/hwui/renderthread/CacheManager.cpp
@@ -23,6 +23,7 @@
#include "pipeline/skia/SkiaMemoryTracer.h"
#include "Properties.h"
#include "renderstate/RenderState.h"
+#include "thread/CommonPool.h"
#include <GrContextOptions.h>
#include <SkExecutor.h>
@@ -76,29 +77,15 @@ void CacheManager::updateContextCacheSizes() {
mGrContext->setResourceCacheLimits(mMaxResources, mMaxResourceBytes);
}
-class CacheManager::SkiaTaskProcessor : public TaskProcessor<bool>, public SkExecutor {
+class CommonPoolExecutor : public SkExecutor {
public:
- explicit SkiaTaskProcessor(TaskManager* taskManager) : TaskProcessor<bool>(taskManager) {}
-
- // This is really a Task<void> but that doesn't really work when Future<>
- // expects to be able to get/set a value
- struct SkiaTask : public Task<bool> {
- std::function<void()> func;
- };
-
virtual void add(std::function<void(void)> func) override {
- sp<SkiaTask> task(new SkiaTask());
- task->func = func;
- TaskProcessor<bool>::add(task);
- }
-
- virtual void onProcess(const sp<Task<bool> >& task) override {
- SkiaTask* t = static_cast<SkiaTask*>(task.get());
- t->func();
- task->setResult(true);
+ CommonPool::post(std::move(func));
}
};
+static CommonPoolExecutor sDefaultExecutor;
+
void CacheManager::configureContext(GrContextOptions* contextOptions, const void* identity, ssize_t size) {
contextOptions->fAllowPathMaskCaching = true;
@@ -107,12 +94,7 @@ void CacheManager::configureContext(GrContextOptions* contextOptions, const void
// provided to Skia.
contextOptions->fGlyphCacheTextureMaximumBytes = GrNextSizePow2(mMaxSurfaceArea);
- if (mTaskManager.canRunTasks()) {
- if (!mTaskProcessor.get()) {
- mTaskProcessor = new SkiaTaskProcessor(&mTaskManager);
- }
- contextOptions->fExecutor = mTaskProcessor.get();
- }
+ contextOptions->fExecutor = &sDefaultExecutor;
auto& cache = skiapipeline::ShaderCache::get();
cache.initShaderDiskCache(identity, size);