Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(54)

Unified Diff: dm/DMTaskRunner.h

Issue 179233005: DM: make GPU tasks multithreaded again. Big refactor. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: default 1 GPU thread Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DMTask.cpp ('k') | dm/DMTaskRunner.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMTaskRunner.h
diff --git a/dm/DMTaskRunner.h b/dm/DMTaskRunner.h
index 8af1b63719af1ec23d639316c7ca20c4d7471b25..c7b40588e99744b021f9923ed5152807ebbf8199 100644
--- a/dm/DMTaskRunner.h
+++ b/dm/DMTaskRunner.h
@@ -5,26 +5,25 @@
#include "SkThreadPool.h"
#include "SkTypes.h"
-// TaskRunner runs Tasks on one of two threadpools depending on the Task's usesGpu() method. This
-// lets us drive the GPU from a single thread while parallelizing CPU-bound work.
+// TaskRunner runs Tasks on one of two threadpools depending on the need for a GrContextFactory.
+// It's typically a good idea to run fewer GPU threads than CPU threads (go nuts with those).
namespace DM {
-class Task;
+class CpuTask;
+class GpuTask;
class TaskRunner : SkNoncopyable {
public:
- explicit TaskRunner(int cputhreads);
+ explicit TaskRunner(int cpuThreads, int gpuThreads);
- void add(Task* task);
+ void add(CpuTask* task);
+ void add(GpuTask* task);
void wait();
- // This can only be safely called from a GPU task's draw() method.
- GrContextFactory* getGrContextFactory() const { return fGrContextFactory; }
-
private:
- SkThreadPool fMain, fGpu;
- GrContextFactory* fGrContextFactory; // Created and destroyed on fGpu threadpool.
+ SkTThreadPool<void> fCpu;
+ SkTThreadPool<GrContextFactory> fGpu;
};
} // namespace DM
« no previous file with comments | « dm/DMTask.cpp ('k') | dm/DMTaskRunner.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698