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

Side by Side Diff: dm/DMTask.h

Issue 185233004: DM: tweak output. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: ws Created 6 years, 9 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 unified diff | Download patch
« no previous file with comments | « dm/DMReporter.cpp ('k') | dm/DMTask.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #ifndef DMTask_DEFINED 1 #ifndef DMTask_DEFINED
2 #define DMTask_DEFINED 2 #define DMTask_DEFINED
3 3
4 #include "DMReporter.h" 4 #include "DMReporter.h"
5 #include "GrContextFactory.h" 5 #include "GrContextFactory.h"
6 #include "SkRunnable.h" 6 #include "SkRunnable.h"
7 #include "SkTime.h"
7 8
8 // DM will run() these tasks on one of two threadpools. 9 // DM will run() these tasks on one of two threadpools.
9 // Subclasses can call fail() to mark this task as failed, or make any number of spawnChild() calls 10 // Subclasses can call fail() to mark this task as failed, or make any number of spawnChild() calls
10 // to kick off dependent tasks. 11 // to kick off dependent tasks.
11 // 12 //
12 // Tasks delete themselves when run. 13 // Tasks delete themselves when run.
13 14
14 namespace DM { 15 namespace DM {
15 16
16 class TaskRunner; 17 class TaskRunner;
17 18
18 class CpuTask; 19 class CpuTask;
19 20
20 class Task { 21 class Task {
21 public: 22 public:
22 virtual bool shouldSkip() const = 0; 23 virtual bool shouldSkip() const = 0;
23 virtual SkString name() const = 0; 24 virtual SkString name() const = 0;
24 25
25 // Returns the number of parents above this task. 26 // Returns the number of parents above this task.
26 // Top-level tasks return 0, their children 1, and so on. 27 // Top-level tasks return 0, their children 1, and so on.
27 int depth() const { return fDepth; } 28 int depth() const { return fDepth; }
28 29
29 protected: 30 protected:
30 Task(Reporter* reporter, TaskRunner* taskRunner); 31 Task(Reporter* reporter, TaskRunner* taskRunner);
31 Task(const Task& parent); 32 Task(const Task& parent);
32 virtual ~Task() {} 33 virtual ~Task() {}
33 34
35 void start();
34 void fail(const char* msg = NULL); 36 void fail(const char* msg = NULL);
35 void finish(); 37 void finish();
38
36 void spawnChild(CpuTask* task); // For now we don't allow GPU child tasks. 39 void spawnChild(CpuTask* task); // For now we don't allow GPU child tasks.
37 40
38 private: 41 private:
39 Reporter* fReporter; // Unowned. 42 Reporter* fReporter; // Unowned.
40 TaskRunner* fTaskRunner; // Unowned. 43 TaskRunner* fTaskRunner; // Unowned.
41 int fDepth; 44 int fDepth;
45 SkMSec fStart;
42 }; 46 };
43 47
44 class CpuTask : public Task, public SkRunnable { 48 class CpuTask : public Task, public SkRunnable {
45 public: 49 public:
46 CpuTask(Reporter* reporter, TaskRunner* taskRunner); 50 CpuTask(Reporter* reporter, TaskRunner* taskRunner);
47 CpuTask(const Task& parent); 51 CpuTask(const Task& parent);
48 virtual ~CpuTask() {} 52 virtual ~CpuTask() {}
49 53
50 void run() SK_OVERRIDE; 54 void run() SK_OVERRIDE;
51 virtual void draw() = 0; 55 virtual void draw() = 0;
52 }; 56 };
53 57
54 class GpuTask : public Task, public SkTRunnable<GrContextFactory> { 58 class GpuTask : public Task, public SkTRunnable<GrContextFactory> {
55 public: 59 public:
56 GpuTask(Reporter* reporter, TaskRunner* taskRunner); 60 GpuTask(Reporter* reporter, TaskRunner* taskRunner);
57 virtual ~GpuTask() {} 61 virtual ~GpuTask() {}
58 62
59 void run(GrContextFactory&) SK_OVERRIDE; 63 void run(GrContextFactory&) SK_OVERRIDE;
60 virtual void draw(GrContextFactory*) = 0; 64 virtual void draw(GrContextFactory*) = 0;
61 }; 65 };
62 66
63 } // namespace DM 67 } // namespace DM
64 68
65 #endif // DMTask_DEFINED 69 #endif // DMTask_DEFINED
OLDNEW
« no previous file with comments | « dm/DMReporter.cpp ('k') | dm/DMTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698