diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-10 18:49:04 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-10 18:49:04 +0000 |
commit | a7538baeae619a513437f89b60cf738ee2de463d (patch) | |
tree | 02a99870251c00edeee1b1635c7fd3166a23f392 /tests/skia_test.cpp | |
parent | dcfed6cecfde7a6e4983c1caf7ffb417c891667f (diff) | |
download | skia-a7538baeae619a513437f89b60cf738ee2de463d.tar.gz |
SkThreadPool: tweak two little things that have been annoying me
1) it's pretty annoying that SkThreadPool doesn't include SkRunnable for us;
2) add wait() so we don't have to keep using SkAutoTDelete/free() to wait for completion.
BUG=
R=scroggo@google.com, reed@google.com
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/26470005
git-svn-id: http://skia.googlecode.com/svn/trunk@11711 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/skia_test.cpp')
-rw-r--r-- | tests/skia_test.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/tests/skia_test.cpp b/tests/skia_test.cpp index 620cdac9c..b8f80e0c4 100644 --- a/tests/skia_test.cpp +++ b/tests/skia_test.cpp @@ -8,7 +8,6 @@ #include "SkCommandLineFlags.h" #include "SkGraphics.h" #include "SkOSFile.h" -#include "SkRunnable.h" #include "SkTArray.h" #include "SkTemplates.h" #include "SkThreadPool.h" @@ -229,7 +228,7 @@ int tool_main(int argc, char** argv) { int32_t failCount = 0; int skipCount = 0; - SkAutoTDelete<SkThreadPool> threadpool(SkNEW_ARGS(SkThreadPool, (FLAGS_threads))); + SkThreadPool threadpool(FLAGS_threads); SkTArray<Test*> unsafeTests; // Always passes ownership to an SkTestRunnable for (int i = 0; i < total; i++) { SkAutoTDelete<Test> test(iter.next()); @@ -238,7 +237,7 @@ int tool_main(int argc, char** argv) { } else if (!test->isThreadsafe()) { unsafeTests.push_back() = test.detach(); } else { - threadpool->add(SkNEW_ARGS(SkTestRunnable, (test.detach(), &failCount))); + threadpool.add(SkNEW_ARGS(SkTestRunnable, (test.detach(), &failCount))); } } @@ -247,8 +246,8 @@ int tool_main(int argc, char** argv) { SkNEW_ARGS(SkTestRunnable, (unsafeTests[i], &failCount))->run(); } - // Blocks until threaded tests finish. - threadpool.free(); + // Block until threaded tests finish. + threadpool.wait(); SkDebugf("Finished %d tests, %d failures, %d skipped.\n", toRun, failCount, skipCount); |