skia2/dm/DMTask.cpp
commit-bot@chromium.org 38aeb0fd7a DM: also run benches once.
Also:
  - make GrMemoryPoolBenches threadsafe
  - some tweaks to various DM code
  - rename GM::shortName() to getName() to match benches and tests

On my desktop, (289 GMs, 617 benches) x 4 configs, 227 tests takes 46s in Debug, 14s in Release.  (Still minutes faster than running tests && bench && gm.)  GPU singlethreading is definitely the limiting factor again; going to reexamine whether that's helpful to thread it again.

BUG=skia:
R=reed@google.com, bsalomon@google.com, mtklein@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/178473006

git-svn-id: http://skia.googlecode.com/svn/trunk@13603 2bbb7eff-a529-9590-31e7-b0007b416f81
2014-02-26 23:01:57 +00:00

54 lines
1.1 KiB
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(this->name());
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(const char* msg) {
SkString failure(this->name());
if (msg) {
failure.appendf(": %s", msg);
}
fReporter->fail(failure);
}
GrContextFactory* Task::getGrContextFactory() const {
return fTaskRunner->getGrContextFactory();
}
} // namespace DM