ParallelCompile: Parallelize D3D linking

This adds a new linking state to Program. If a Program is in linking
state, on the one hand the foreground thread may continue issuing more
GL calls, and on the other hand the background linking threads may be
accessing Program internally too. Without a proper constraint there
must be conflicts between them. For this purpose, we block any further
GL calls to Program until it's actually linked. In addition, we
prohibit parallel linking an active program, so that ProgramD3D does
not have to worry about such similar conflicts.

Also changes the WorkerThread to support limiting the number of
concurrently running worker threads.

BUG=chromium:849576

Change-Id: I52618647539323f8bf27201320bdf7301c4982e6
Reviewed-on: https://chromium-review.googlesource.com/1127495
Commit-Queue: Jie A Chen <jie.a.chen@intel.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
diff --git a/util/shader_utils.h b/util/shader_utils.h
index e0dc3e5..176f55f 100644
--- a/util/shader_utils.h
+++ b/util/shader_utils.h
@@ -34,6 +34,9 @@
                                          const std::vector<std::string> &transformFeedbackVaryings,
                                          GLenum bufferMode);
 ANGLE_EXPORT GLuint CompileProgram(const std::string &vsSource, const std::string &fsSource);
+ANGLE_EXPORT GLuint CompileProgramParallel(const std::string &vsSource,
+                                           const std::string &fsSource);
+
 ANGLE_EXPORT GLuint CompileProgramWithGS(const std::string &vsSource,
                                          const std::string &gsSource,
                                          const std::string &fsSource);