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

Unified Diff: dm/DMTaskRunner.cpp

Issue 531653002: SkThreadPool ~~> SkTaskGroup (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: cleanup allowThreaded() Created 6 years, 4 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 | « dm/DMTaskRunner.h ('k') | dm/DMTestTask.h » ('j') | src/utils/SkRunnable.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMTaskRunner.cpp
diff --git a/dm/DMTaskRunner.cpp b/dm/DMTaskRunner.cpp
index 8a0bc838e174d96b0c87986e3a4af89725a8b93d..30d07babc866959b4d2148105c5d2a76c9239a7e 100644
--- a/dm/DMTaskRunner.cpp
+++ b/dm/DMTaskRunner.cpp
@@ -3,19 +3,19 @@
namespace DM {
-TaskRunner::TaskRunner(int cpuThreads, int gpuThreads) : fCpu(cpuThreads), fGpu(gpuThreads) {}
+TaskRunner::TaskRunner(int cpuThreads) {
+ SkTaskGroup::SetThreadCount(cpuThreads);
+}
-void TaskRunner::add(CpuTask* task) { fCpu.add(task); }
-void TaskRunner::addNext(CpuTask* task) { fCpu.addNext(task); }
-void TaskRunner::add(GpuTask* task) { fGpu.add(task); }
+void TaskRunner::add(CpuTask* task) { fCpuWork.add(task); }
+void TaskRunner::add(GpuTask* task) { fGpuWork.push(task); }
void TaskRunner::wait() {
- // These wait calls block until each threadpool is done. We don't allow
- // spawning new child GPU tasks, so we can wait for that first knowing
- // we'll never try to add to it later. Same can't be said of the CPU pool:
- // both CPU and GPU tasks can spawn off new CPU work, so we wait for that last.
- fGpu.wait();
- fCpu.wait();
+ GrContextFactory factory;
+ for (int i = 0; i < fGpuWork.count(); i++) {
+ fGpuWork[i]->run(&factory);
+ }
+ fCpuWork.wait();
}
} // namespace DM
« no previous file with comments | « dm/DMTaskRunner.h ('k') | dm/DMTestTask.h » ('j') | src/utils/SkRunnable.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698