Reland 2: Promises: Add AbstractPromise
This is the internal promise representation. It implements the machinery needed to marshal and dispatch promises as they become ready for execution. Care has been taken to try and minimize the size of the AbstractPromise class and to keep down the number of heap allocations. The promise result and the executor are both stored in the base::unique_any since they are never needed at the same time. The size of AbstractPromise on x64 is 96 bytes in builds without DCHECKS. In builds with DCHECKS it's larger because there's additional storage used to diagnose and prevent various usage hazards: * Unhandled rejection * Double move of promise results to callbacks * Mixed move and non-move semantics of promise results to callbacks The base::any_internal type has been adjusted so it can store the SmallUniqueObject<> inline, which is used to store the promise executor. The largest anticipated promise executor base::All is the size of 3x sizeof(void*) to hold a vtable and a std::vector. Design: https://docs.google.com/document/d/1l12PAJgEtlrqTXKiw6mk2cR2jP7FAfCCDr-DGIdiC9w/edit TBR=fdoray@chromium.org, etiennep@chromium.org Bug: 906125 Change-Id: I62cecf23ecc8ea3ef7417d6ad40c0911fac5339c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1607643Reviewed-by:Alex Clarke <alexclarke@chromium.org> Commit-Queue: Alex Clarke <alexclarke@chromium.org> Cr-Commit-Position: refs/heads/master@{#658982}
Showing
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Please register or sign in to comment