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

Unified Diff: dm/DMTask.cpp

Issue 22839016: Skeleton of DM (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: one last sync Created 7 years, 2 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') | dm/DMTaskRunner.h » ('j') | 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
new file mode 100644
index 0000000000000000000000000000000000000000..9b463f90031b555c27f5470c0c7fb1a33c11baa8
--- /dev/null
+++ b/dm/DMTask.cpp
@@ -0,0 +1,42 @@
+#include "DMTask.h"
+
+#include "DMTaskRunner.h"
+#include "DMUtil.h"
+#include "SkBitmap.h"
+#include "SkCommandLineFlags.h"
+
+namespace DM {
+
+Task::Task(Reporter* reporter, TaskRunner* taskRunner)
+ : fReporter(reporter), fTaskRunner(taskRunner) {
+ fReporter->start();
+}
+
+Task::Task(const Task& that) : fReporter(that.fReporter), fTaskRunner(that.fTaskRunner) {
+ fReporter->start();
+}
+
+Task::~Task() {}
+
+void Task::run() {
+ if (!this->shouldSkip()) {
+ this->draw();
+ }
+ fReporter->finish();
+ fReporter->updateStatusLine();
+ delete this;
+}
+
+void Task::spawnChild(Task* task) {
+ if (!task->usesGpu()) {
+ fTaskRunner->add(task);
+ } else {
+ SkDEBUGFAIL("Sorry, we can't spawn GPU tasks. :( See comment in TaskRunner::wait().");
+ }
+}
+
+void Task::fail() {
+ fReporter->fail(this->name());
+}
+
+} // namespace DM
« no previous file with comments | « dm/DMTask.h ('k') | dm/DMTaskRunner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698