Add support for user defined "pool" to GN.

Allow user to define pool of limited size to limit the number of
concurrent tasks that are executed for a given set of tools. The
pool object directly correspond to a ninja pool and can be shared
by multiple targets.

Design document:
https://docs.google.com/document/d/1b598i4WmeFOe3_iRBrjPKSXdcR5R32UPtgxqKmoY2-M/view

BUG=612786

Review-Url: https://codereview.chromium.org/2006923004
Cr-Commit-Position: refs/heads/master@{#397917}
diff --git a/tools/gn/tool.h b/tools/gn/tool.h
index f6727ed..96ff7c02 100644
--- a/tools/gn/tool.h
+++ b/tools/gn/tool.h
@@ -9,9 +9,13 @@
 
 #include "base/logging.h"
 #include "base/macros.h"
+#include "tools/gn/label.h"
+#include "tools/gn/label_ptr.h"
 #include "tools/gn/substitution_list.h"
 #include "tools/gn/substitution_pattern.h"
 
+class Pool;
+
 class Tool {
  public:
   enum DepsFormat {
@@ -173,6 +177,9 @@
     rspfile_content_ = content;
   }
 
+  const LabelPtrPair<Pool>& pool() const { return pool_; }
+  void set_pool(const LabelPtrPair<Pool>& pool) { pool_ = pool; }
+
   // Other functions ----------------------------------------------------------
 
   // Called when the toolchain is saving this tool, after everything is filled
@@ -191,6 +198,8 @@
     return substitution_bits_;
   }
 
+  bool OnResolved(Err* err);
+
  private:
   SubstitutionPattern command_;
   std::string default_output_extension_;
@@ -209,6 +218,7 @@
   bool restat_;
   SubstitutionPattern rspfile_;
   SubstitutionPattern rspfile_content_;
+  LabelPtrPair<Pool> pool_;
 
   bool complete_;