Auto-merge duplicate pools between subninja chdir's

Note: Pools cannot have the same name, except in the very rare case that
a subninja chdir invokes an entirely separate build which then has a
pool with the same name.

Even then, the pools are silently merged across subninja chdirs, unless
the depth value does not match. The special predefined 'console' pool
will always have a depth of 1, so references to it get merged by the
same logic.

Pools are *not* supposed to break the build due to these subtle nuances
of when they are merged and when they are not. Pools are supposed to be
a useful decorator that optimizes the build for some rare rules that
need to have *less* parallelism. Sometimes the different trees being
built cannot avoid having duplicate pool names because the sources are
maintained by different parties. The goal then is to *not* break the
build, by either silently merging pools as much as possible, and
otherwise allowing pools with the same name to silently coexist.

Each pool must have a unique tuple
( Scope* Pool::parent_, HashedStr name_ )

Change-Id: Id220ed9baa41af3ddb902e8e20bd03f6acbb4441
5 files changed