Reland (2) Promises: Implement Promise<> handle with Then and Catch

It turns out SmallUniqueObject casting itself to the derived
object is undefined behavior... There is an ugly workaround
similar to unique_any we need to roll our own vtable :(

At least UBSan is happy with it.

Tests failed on UBSanVptr bot
https://ci.chromium.org/p/chromium/builders/ci/ToTLinuxUBSanVptr/6837.

They pass with this CL.

Original patch https://crrev.com/c/1599620

Implements Then and Catch on top of AbstractPromise as well as
ManualPromiseResolver<> which is needed for testing at this
stage (PostTask doesn't yet return a promise). It's also
necessary for promises to interface with old style callback
based libraries which are extremely common in Chromium.

Design: https://docs.google.com/document/d/1l12PAJgEtlrqTXKiw6mk2cR2jP7FAfCCDr-DGIdiC9w/edit

Bug: 906125
Change-Id: I5ae1412f01d64c4d06b9208a41dfc5b8b51435fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1617825
Commit-Queue: Alex Clarke <alexclarke@chromium.org>
Reviewed-by: Fran├žois Doray <fdoray@chromium.org>
Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#661888}
17 files changed