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

Unified Diff: dm/DMTaskRunner.h

Issue 22839016: Skeleton of DM (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: missed one Created 7 years, 2 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
Index: dm/DMTaskRunner.h
diff --git a/dm/DMTaskRunner.h b/dm/DMTaskRunner.h
new file mode 100644
index 0000000000000000000000000000000000000000..292facc970eb43cafd705f256ce49a3992e8b41a
--- /dev/null
+++ b/dm/DMTaskRunner.h
@@ -0,0 +1,29 @@
+#ifndef DMTaskRunner_DEFINED
+#define DMTaskRunner_DEFINED
+
+#include "SkTemplates.h"
+#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 with a small number of threads (e.g. 2 or 4 can be faster than 1)
+// while not swamping it with requests from the full fleet of threads that CPU-bound tasks run on.
+
+namespace DM {
+
+class Task;
+
+class TaskRunner : SkNoncopyable {
+public:
+ TaskRunner(int cputhreads, int gpuThreads);
+
+ void add(Task* task);
+ void wait();
+
+private:
+ SkAutoTDelete<SkThreadPool> fMain, fGpu;
scroggo 2013/10/11 21:20:48 Now that you've added wait() to SkThreadPool, you
mtklein 2013/10/15 18:30:53 Absolutely. Done.
+};
+
+} // namespace DM
+
+#endif // DMTaskRunner_DEFINED

Powered by Google App Engine
This is Rietveld 408576698