Make PartitionAllocHooks thread-safe

Previously PartitionAllocHooks would read/write hooks non-atomically,
evne though this data was global and could be accessed across threads.
Introduce the use of std::atomic<>s to make loads atomic and
specifically use relaxed memory ordering on the allocation/free hot
paths for performance. Also introduce synchronization for concurrent
calls to SetObserverHooks().

Also fix a missing rename from https://crrev.com/c/1585325:
ObserverRealloc -> ReallocObserver.

Bug: 957221
Change-Id: I90d44912b730cbad2fd98ad79bbb873587e3c093
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1588946
Reviewed-by: Chris Palmer <palmer@chromium.org>
Reviewed-by: Kentaro Hara <haraken@chromium.org>
Commit-Queue: Vlad Tsyrklevich <vtsyrklevich@chromium.org>
Cr-Commit-Position: refs/heads/master@{#655129}
2 files changed