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

Unified Diff: tests/SkpSkGrTest.cpp

Issue 1184373003: Add sk_parallel_for() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix Created 5 years, 6 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/PathOpsThreadedCommon.cpp ('k') | tools/skpdiff/SkDiffContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkpSkGrTest.cpp
diff --git a/tests/SkpSkGrTest.cpp b/tests/SkpSkGrTest.cpp
index 2c3c5b7fbf74f1514e673bf7b347833bcee0ceae..212b0f6abde791b25be9892df611f4a55ff0a22b 100644
--- a/tests/SkpSkGrTest.cpp
+++ b/tests/SkpSkGrTest.cpp
@@ -1,6 +1,9 @@
-#if !SK_SUPPORT_GPU
-#error "GPU support required"
-#endif
+/*
+ * Copyright 2013 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
#include "GrContext.h"
#include "GrContextFactory.h"
@@ -27,6 +30,10 @@
#include "SkTime.h"
#include "Test.h"
+#if !SK_SUPPORT_GPU
+#error "GPU support required"
+#endif
+
#ifdef SK_BUILD_FOR_WIN
#define PATH_SLASH "\\"
#define IN_DIR "D:\\9-30-13\\"
@@ -162,10 +169,11 @@ SkpSkGrThreadedTestRunner::~SkpSkGrThreadedTestRunner() {
}
void SkpSkGrThreadedTestRunner::render() {
- SkTaskGroup tg;
- for (int index = 0; index < fRunnables.count(); ++ index) {
- tg.add(fRunnables[index]);
- }
+ // TODO: we don't really need to be using SkRunnables here anymore.
+ // We can just write the code we'd run right in the for loop.
+ sk_parallel_for(fRunnables.count(), [&](int i) {
+ fRunnables[i]->run();
+ });
}
////////////////////////////////////////////////
« no previous file with comments | « tests/PathOpsThreadedCommon.cpp ('k') | tools/skpdiff/SkDiffContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698