factor Engine out of ok core

This makes Engines (task execution strategies: serial, thread, fork)
pluggable just like most of the rest of ok.  It removes the thread and
process limits, as I find myself rarely caring about what they are
exactly.  Instead of limiting to num-cores, we just allow any number of
concurrent threads, and any number of concurrent child processes subject
to OS limitations.

Change-Id: Icef49d86818fe9a4b7380efb60e73e40bc2e6b73
Reviewed-on: https://skia-review.googlesource.com/27140
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Mike Klein <mtklein@chromium.org>
diff --git a/tools/ok.h b/tools/ok.h
index f55842b..502df23 100644
--- a/tools/ok.h
+++ b/tools/ok.h
@@ -10,6 +10,7 @@
 
 #include "SkCanvas.h"
 #include <functional>
+#include <future>
 #include <map>
 #include <memory>
 #include <string>
@@ -24,6 +25,12 @@
 
 enum class Status { OK, Failed, Crashed, Skipped, None };
 
+struct Engine {
+    virtual ~Engine() {}
+    virtual bool                crashproof()                       = 0;
+    virtual std::future<Status> spawn(std::function<Status(void)>) = 0;
+};
+
 struct Src {
     virtual ~Src() {}
     virtual std::string name()     = 0;
@@ -52,6 +59,7 @@
 
 // Create globals to register your new type of Stream or Dst.
 struct Register {
+    Register(const char* name, const char* help, std::unique_ptr<Engine> (*factory)(Options));
     Register(const char* name, const char* help, std::unique_ptr<Stream> (*factory)(Options));
     Register(const char* name, const char* help, std::unique_ptr<Dst>    (*factory)(Options));
     Register(const char* name, const char* help,