This patch corrects a few different issues related to recycling
MacIOSurface objects.
1) When recycling a surface, we must check that the cached surfaces
match all of the requested parameters, not just the size. If we do
not, we should just flush the whole cache immediately since they
should all be created with the same parameters.
2) Allocations can fail, and we should check for failing to get a
surface from the allocator and fall back if so.
3) Locking can fail, and we should check that return value at all of the
call sites.
This may help resolve a number of otherwise difficult to understand
crash signatures. It may also solve display corruption issues in rare
cases where the parameters that changed were roughly equivalent such
that everything appears to work, but they differ enough to change the
presentation.
Differential Revision: https://phabricator.services.mozilla.com/D222775