skia2/dm/DMTask.cpp
rmistry@google.com d6bab02386 Reverting r12427
git-svn-id: http://skia.googlecode.com/svn/trunk@12428 2bbb7eff-a529-9590-31e7-b0007b416f81
2013-12-02 13:50:38 +00:00

47 lines
938 B
C++

#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), fDepth(0) {
fReporter->start();
}
Task::Task(const Task& parent)
: INHERITED(parent)
, fReporter(parent.fReporter)
, fTaskRunner(parent.fTaskRunner)
, fDepth(parent.depth()+1) {
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