Task processor to parcel out 2D work to threads.

This CL introduces the TaskProcessor class, which is used to parcel out
a potentially very large 2D space into chunks of works to a thread pool.

Upcoming CLs will use this TaskProcessor for implementing the Toolkit
operations.

Bug: 178476084
Test: Compile and ran the test using hwsan.
Change-Id: Ie04e7caaeb4d4c16721373cce14df584a9f34fb3
diff --git a/toolkit/Android.bp b/toolkit/Android.bp
index 5d900e2..ab14056 100644
--- a/toolkit/Android.bp
+++ b/toolkit/Android.bp
@@ -4,6 +4,17 @@
 
 // TODO: In later CLs, this build file will be replaced by a stand alone build that's not part of Android.
 
+cc_binary {
+    name: "renderscripttoolkittest",
+    srcs: [
+        "TestTaskProcessor.cpp"
+    ],
+    shared_libs: [
+         "libbase",
+    	 "librenderscripttoolkit",
+    ],
+}
+
 cc_library_shared {
     name: "librenderscripttoolkit",
     defaults: [],
@@ -16,6 +27,8 @@
 
     srcs: [
         // TODO A later CL will modify the files below to compile independently of the rest of RenderScript
+	"TaskProcessor.cpp",
+	"Utils.cpp",
         //"Lut3d.cpp",
         //"Blend.cpp",
         //"Blur.cpp",
@@ -28,6 +41,8 @@
         //"YuvToRgb.cpp",
     ],
 
+    static_libs: [ "cpufeatures" ],
+
     arch: {
         arm64: {
             cflags: [
@@ -86,6 +101,7 @@
     },
 
     shared_libs: [
+        "libbase",
         // TODO Once we compile in the .cpp files, check if any of these libraries are needed.
         //"libc++",
         //"liblog",
@@ -101,6 +117,7 @@
     ],
 
     cflags: [
+        "-Wthread-safety",
         "-Werror",
         "-Wall",
         "-Wextra",