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

Unified Diff: tests/PathOpsSkpClipTest.cpp

Issue 533393002: Revert of SkThreadPool ~~> SkTaskGroup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « tests/PathOpsSimplifyTrianglesThreadedTest.cpp ('k') | tests/PathOpsThreadedCommon.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsSkpClipTest.cpp
diff --git a/tests/PathOpsSkpClipTest.cpp b/tests/PathOpsSkpClipTest.cpp
index 076914168558283fd32d61d3861e0f1d537b6f8e..cdc3c1fcd910d8e2c2062e078126cb9c84b80bab 100755
--- a/tests/PathOpsSkpClipTest.cpp
+++ b/tests/PathOpsSkpClipTest.cpp
@@ -20,8 +20,8 @@
#include "SkString.h"
#include "SkTArray.h"
#include "SkTDArray.h"
-#include "SkTaskGroup.h"
#include "SkTemplates.h"
+#include "SkThreadPool.h"
#include "SkTime.h"
__SK_FORCE_IMAGE_DECODER_LINKING;
@@ -90,14 +90,14 @@
}
if (filename) {
path.appendf("%s%s", PATH_SLASH, filename);
- if (!sk_exists(path.c_str())) {
+ if (!sk_exists(path.c_str())) {
SkDebugf("could not read %s\n", path.c_str());
return SkString();
}
}
return path;
}
-
+
static void make_recursive_dir(const SkString& path) {
if (sk_exists(path.c_str())) {
return;
@@ -129,7 +129,7 @@
make_recursive_dir(path);
return path;
}
-
+
static SkString get_sum_path(const char* dirName) {
SkString path;
SkASSERT(dirName);
@@ -166,12 +166,12 @@
fTestStep = kCompareBits;
fScale = 1;
}
-
+
void init(int dirNo, const SkString& filename) {
fDirNo = dirNo;
strcpy(fFilename, filename.c_str());
fTestStep = kCompareBits;
- fScale = 1;
+ fScale = 1;
}
SkString status() {
@@ -204,7 +204,7 @@
}
void testOne();
-
+
char fFilename[kMaxLength];
TestStep fTestStep;
int fDirNo;
@@ -245,8 +245,13 @@
};
struct TestRunner {
+ TestRunner(int threadCount)
+ : fNumThreads(threadCount) {
+ }
+
~TestRunner();
void render();
+ int fNumThreads;
SkTDArray<class TestRunnable*> fRunnables;
};
@@ -295,9 +300,9 @@
}
void TestRunner::render() {
- SkTaskGroup tg;
+ SkThreadPool pool(fNumThreads);
for (int index = 0; index < fRunnables.count(); ++ index) {
- tg.add(fRunnables[index]);
+ pool.add(fRunnables[index]);
}
}
@@ -526,10 +531,16 @@
DEFINE_string2(skp, s, NULL, "skp to test");
DEFINE_bool2(single, z, false, "run tests on a single thread internally.");
DEFINE_int32(testIndex, 0, "override local test index (PathOpsSkpClipOneOff only).");
+DEFINE_int32(threads, SkThreadPool::kThreadPerCore,
+ "Run threadsafe tests on a threadpool with this many threads.");
DEFINE_bool2(verbose, v, false, "enable verbose output.");
static bool verbose() {
return FLAGS_verbose;
+}
+
+static int getThreadCount() {
+ return FLAGS_single ? 1 : FLAGS_threads;
}
class Dirs {
@@ -605,7 +616,7 @@
}
return NULL;
}
-
+
void set(const SkCommandLineFlags::StringArray& names) {
fNames = &names;
}
@@ -615,7 +626,7 @@
const SkCommandLineFlags::StringArray* fNames;
} gNames;
-static bool buildTestDir(int dirNo, int firstDirNo,
+static bool buildTestDir(int dirNo, int firstDirNo,
SkTDArray<TestResult>* tests, SkTDArray<SortByName*>* sorted) {
SkString dirName = get_out_path(dirNo, outStatusDir);
if (!dirName.size()) {
@@ -781,7 +792,8 @@
}
}
}
- TestRunner testRunner;
+ int threadCount = getThreadCount();
+ TestRunner testRunner(threadCount);
for (int index = 0; index < state.fPixelWorst.count(); ++index) {
const TestResult& result = state.fPixelWorst[index];
SkString filename(result.fFilename);
@@ -853,7 +865,8 @@
DEF_TEST(PathOpsSkpClipThreaded) {
gDirs.setDefault();
initTest();
- TestRunner testRunner;
+ int threadCount = getThreadCount();
+ TestRunner testRunner(threadCount);
int dirNo;
gDirs.reset();
while ((dirNo = gDirs.next()) > 0) {
@@ -876,7 +889,7 @@
}
encodeFound(state);
}
-
+
static bool buildTests(SkTDArray<TestResult>* tests, SkTDArray<SortByName*>* sorted) {
int firstDirNo = gDirs.first();
int dirNo;
@@ -899,7 +912,8 @@
if (!buildTests(tests.get(), sorted.get())) {
return;
}
- TestRunner testRunner;
+ int threadCount = getThreadCount();
+ TestRunner testRunner(threadCount);
int dirNo;
gDirs.reset();
while ((dirNo = gDirs.next()) > 0) {
« no previous file with comments | « tests/PathOpsSimplifyTrianglesThreadedTest.cpp ('k') | tests/PathOpsThreadedCommon.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698