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

Side by Side Diff: dm/DMTestTask.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, 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/DMTaskRunner.cpp ('k') | dm/DMTestTask.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 DMTestTask_DEFINED 1 #ifndef DMTestTask_DEFINED
2 #define DMTestTask_DEFINED 2 #define DMTestTask_DEFINED
3 3
4 #include "DMReporter.h" 4 #include "DMReporter.h"
5 #include "DMTask.h" 5 #include "DMTask.h"
6 #include "DMTaskRunner.h" 6 #include "DMTaskRunner.h"
7 #include "SkString.h" 7 #include "SkString.h"
8 #include "SkTemplates.h" 8 #include "SkTemplates.h"
9 #include "Test.h" 9 #include "Test.h"
10 10
11 // Runs a unit test. 11 // Runs a unit test.
12 namespace DM { 12 namespace DM {
13 13
14 class TestTask : public Task { 14 class TestReporter : public skiatest::Reporter {
15 public: 15 public:
16 TestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory); 16 TestReporter() {}
17
18 const char* failure() const { return fFailure.c_str(); }
19
20 private:
21 virtual bool allowExtendedTest() const SK_OVERRIDE;
22 virtual bool allowThreaded() const SK_OVERRIDE;
23 virtual bool verbose() const SK_OVERRIDE;
24
25 virtual void onReportFailed(const SkString& desc) SK_OVERRIDE {
26 fFailure = desc;
27 }
28
29 SkString fFailure;
30 };
31
32 class CpuTestTask : public CpuTask {
33 public:
34 CpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory);
17 35
18 virtual void draw() SK_OVERRIDE; 36 virtual void draw() SK_OVERRIDE;
19 virtual bool usesGpu() const SK_OVERRIDE { return fTest->isGPUTest(); }
20 virtual bool shouldSkip() const SK_OVERRIDE { return false; } 37 virtual bool shouldSkip() const SK_OVERRIDE { return false; }
21 virtual SkString name() const SK_OVERRIDE { return fName; } 38 virtual SkString name() const SK_OVERRIDE { return fName; }
22 39
23 private: 40 private:
24 class TestReporter : public skiatest::Reporter {
25 public:
26 TestReporter() {}
27
28 const char* failure() const { return fFailure.c_str(); }
29
30 private:
31 virtual bool allowExtendedTest() const SK_OVERRIDE;
32 virtual bool allowThreaded() const SK_OVERRIDE;
33 virtual bool verbose() const SK_OVERRIDE;
34
35 virtual void onReportFailed(const SkString& desc) SK_OVERRIDE {
36 fFailure = desc;
37 }
38
39 SkString fFailure;
40 };
41
42 TestReporter fTestReporter; 41 TestReporter fTestReporter;
43 SkAutoTDelete<skiatest::Test> fTest; 42 SkAutoTDelete<skiatest::Test> fTest;
44 const SkString fName; 43 const SkString fName;
44 };
45
46 class GpuTestTask : public GpuTask {
47 public:
48 GpuTestTask(Reporter*, TaskRunner*, skiatest::TestRegistry::Factory);
49
50 virtual void draw(GrContextFactory*) SK_OVERRIDE;
51 virtual bool shouldSkip() const SK_OVERRIDE { return false; }
52 virtual SkString name() const SK_OVERRIDE { return fName; }
53
54 private:
55 TestReporter fTestReporter;
56 SkAutoTDelete<skiatest::Test> fTest;
57 const SkString fName;
45 }; 58 };
46 59
47 } // namespace DM 60 } // namespace DM
48 61
49 #endif // DMTestTask_DEFINED 62 #endif // DMTestTask_DEFINED
OLDNEW
« no previous file with comments | « dm/DMTaskRunner.cpp ('k') | dm/DMTestTask.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698