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

Side by Side Diff: dm/DMTestTask.cpp

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/DMTestTask.h ('k') | dm/DMTileGridTask.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #include "DMTestTask.h" 1 #include "DMTestTask.h"
2 #include "DMUtil.h" 2 #include "DMUtil.h"
3 #include "SkCommandLineFlags.h" 3 #include "SkCommandLineFlags.h"
4 4
5 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests."); 5 DEFINE_bool2(pathOpsExtended, x, false, "Run extended pathOps tests.");
6 DEFINE_bool2(pathOpsSingleThread, z, false, "Disallow pathOps tests from using t hreads."); 6 DEFINE_bool2(pathOpsSingleThread, z, false, "Disallow pathOps tests from using t hreads.");
7 DEFINE_bool2(pathOpsVerbose, V, false, "Tell pathOps tests to be verbose.") ; 7 DEFINE_bool2(pathOpsVerbose, V, false, "Tell pathOps tests to be verbose.") ;
8 8
9 namespace DM { 9 namespace DM {
10 10
11 bool TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExtended; }
12 bool TestReporter::allowThreaded() const { return !FLAGS_pathOpsSingleThread ; }
13 bool TestReporter::verbose() const { return FLAGS_pathOpsVerbose; }
14
11 static SkString test_name(const char* name) { 15 static SkString test_name(const char* name) {
12 SkString result("test "); 16 SkString result("test ");
13 result.append(name); 17 result.append(name);
14 return result; 18 return result;
15 } 19 }
16 20
17 TestTask::TestTask(Reporter* reporter, 21 CpuTestTask::CpuTestTask(Reporter* reporter,
18 TaskRunner* taskRunner, 22 TaskRunner* taskRunner,
19 skiatest::TestRegistry::Factory factory) 23 skiatest::TestRegistry::Factory factory)
20 : Task(reporter, taskRunner) 24 : CpuTask(reporter, taskRunner)
21 , fTest(factory(NULL)) 25 , fTest(factory(NULL))
22 , fName(test_name(fTest->getName())) {} 26 , fName(test_name(fTest->getName())) {}
23 27
24 void TestTask::draw() { 28 GpuTestTask::GpuTestTask(Reporter* reporter,
25 if (this->usesGpu()) { 29 TaskRunner* taskRunner,
26 fTest->setGrContextFactory(this->getGrContextFactory()); 30 skiatest::TestRegistry::Factory factory)
27 } 31 : GpuTask(reporter, taskRunner)
32 , fTest(factory(NULL))
33 , fName(test_name(fTest->getName())) {}
34
35
36 void CpuTestTask::draw() {
28 fTest->setReporter(&fTestReporter); 37 fTest->setReporter(&fTestReporter);
29 fTest->run(); 38 fTest->run();
30 if (!fTest->passed()) { 39 if (!fTest->passed()) {
31 this->fail(fTestReporter.failure()); 40 this->fail(fTestReporter.failure());
32 } 41 }
33 } 42 }
34 43
35 bool TestTask::TestReporter::allowExtendedTest() const { return FLAGS_pathOpsExt ended; } 44 void GpuTestTask::draw(GrContextFactory* grFactory) {
36 bool TestTask::TestReporter::allowThreaded() const { return !FLAGS_pathOpsSi ngleThread; } 45 fTest->setGrContextFactory(grFactory);
37 bool TestTask::TestReporter::verbose() const { return FLAGS_pathOpsVer bose; } 46 fTest->setReporter(&fTestReporter);
47 fTest->run();
48 if (!fTest->passed()) {
49 this->fail(fTestReporter.failure());
50 }
51 }
38 52
39 } // namespace DM 53 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMTestTask.h ('k') | dm/DMTileGridTask.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698