Previously, the shared memory handler held a region and mapped the
region each time a buffer was ready. However, this requires leaving the
original GpuMemoryBufferHandle in a partially-valid state, which
complicates follow up CLs to turn GpuMemoryBufferHandle into a true
variant.
After this, SharedMemoryBufferHandleHolder only holds the mapping.
Compared to the original semantics:
- it doesn't change the content of what's mapped in: calling `Map()`
repeatedly on the same region will always produce a mapping that
yields the same logical content, even if mapped at a different
address.
- mapping once vs repeatedly mapping is a bit of a wash: `Map()` is a
fallible operation if the OS cannot find enough contiguous address
space . But this should be rare...
- to ensure the mapping lives as long as any frames that reference it,
the mapping itself is held in a `base::RefCountedData`
Bug: 40584691
Change-Id: Ia5c7c1d53d157df62eb7d2e1327790ef54db4f0d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6432320
Commit-Queue: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Xiaoqian Dai <xdai@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1443298}