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

Unified Diff: dm/DMTask.cpp

Issue 261593008: DM: run child tasks that are already on the CPU threadpool serially (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: oops Created 6 years, 8 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/DMTask.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMTask.cpp
diff --git a/dm/DMTask.cpp b/dm/DMTask.cpp
index 8b6a94e52ad33a016eadbb7c033be77789c496eb..83df84933f8cd816d8910f7d039f880208e67d6c 100644
--- a/dm/DMTask.cpp
+++ b/dm/DMTask.cpp
@@ -37,7 +37,7 @@ void Task::finish() {
fReporter->finish(this->name(), SkTime::GetMSecs() - fStart);
}
-void Task::spawnChild(CpuTask* task) {
+void Task::reallySpawnChild(CpuTask* task) {
fTaskRunner->add(task);
}
@@ -53,6 +53,11 @@ void CpuTask::run() {
SkDELETE(this);
}
+void CpuTask::spawnChild(CpuTask* task) {
+ // Run children serially on this (CPU) thread. This tends to save RAM and is usually no slower.
+ task->run();
+}
+
GpuTask::GpuTask(Reporter* reporter, TaskRunner* taskRunner) : Task(reporter, taskRunner) {}
void GpuTask::run(GrContextFactory& factory) {
@@ -64,6 +69,9 @@ void GpuTask::run(GrContextFactory& factory) {
SkDELETE(this);
}
-
+void GpuTask::spawnChild(CpuTask* task) {
+ // Really spawn a new task so it runs on the CPU threadpool instead of the GPU one we're on now.
+ this->reallySpawnChild(task);
+}
} // namespace DM
« no previous file with comments | « dm/DMTask.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698