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

Unified Diff: dm/DMTask.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/DMSerializeTask.cpp ('k') | dm/DMTask.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMTask.h
diff --git a/dm/DMTask.h b/dm/DMTask.h
index e8598df85e00ee6001b3f2571f356a4ae91d7daa..cad8234c05b5047c3c31ddff642d2ab7c210c9cf 100644
--- a/dm/DMTask.h
+++ b/dm/DMTask.h
@@ -4,28 +4,21 @@
#include "DMReporter.h"
#include "GrContextFactory.h"
#include "SkRunnable.h"
-#include "SkThreadPool.h"
-// DM will run() these tasks on one of two threadpools, depending on the result
-// of usesGpu(). The subclasses can call fail() to mark this task as failed,
-// or make any number of spawnChild() calls to kick off dependent tasks.
+// DM will run() these tasks on one of two threadpools.
+// Subclasses can call fail() to mark this task as failed, or make any number of spawnChild() calls
+// to kick off dependent tasks.
//
-// Task deletes itself when run.
+// Tasks delete themselves when run.
namespace DM {
class TaskRunner;
-class Task : public SkRunnable {
-public:
- Task(Reporter* reporter, TaskRunner* taskRunner);
- Task(const Task& parent);
- virtual ~Task();
-
- void run() SK_OVERRIDE;
+class CpuTask;
- virtual void draw() = 0;
- virtual bool usesGpu() const = 0;
+class Task {
+public:
virtual bool shouldSkip() const = 0;
virtual SkString name() const = 0;
@@ -34,19 +27,37 @@ public:
int depth() const { return fDepth; }
protected:
- void spawnChild(Task* task);
- void fail(const char* msg = NULL);
+ Task(Reporter* reporter, TaskRunner* taskRunner);
+ Task(const Task& parent);
+ virtual ~Task() {}
- // This can only be safely called from a GPU task's draw() method.
- GrContextFactory* getGrContextFactory() const;
+ void fail(const char* msg = NULL);
+ void finish();
+ void spawnChild(CpuTask* task); // For now we don't allow GPU child tasks.
private:
- // Both unowned.
- Reporter* fReporter;
- TaskRunner* fTaskRunner;
+ Reporter* fReporter; // Unowned.
+ TaskRunner* fTaskRunner; // Unowned.
int fDepth;
+};
+
+class CpuTask : public Task, public SkRunnable {
+public:
+ CpuTask(Reporter* reporter, TaskRunner* taskRunner);
+ CpuTask(const Task& parent);
+ virtual ~CpuTask() {}
+
+ void run() SK_OVERRIDE;
+ virtual void draw() = 0;
+};
+
+class GpuTask : public Task, public SkTRunnable<GrContextFactory> {
+ public:
+ GpuTask(Reporter* reporter, TaskRunner* taskRunner);
+ virtual ~GpuTask() {}
- typedef SkRunnable INHERITED;
+ void run(GrContextFactory&) SK_OVERRIDE;
+ virtual void draw(GrContextFactory*) = 0;
};
} // namespace DM
« no previous file with comments | « dm/DMSerializeTask.cpp ('k') | dm/DMTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698