RESTRICT AUTOMERGE: Cherry-pick "begin cleanup of malloc porting layer"
Test: Not feasible
1. Merge some of the allocators into sk_malloc_flags by redefining a flag to mean zero-init
2. Add more private helpers to simplify our call-sites (and handle some overflow mul checks)
3. The 2-param helpers rely on the saturating SkSafeMath::Mul to pass max_size_t as the request,
which should always fail.
Commit-Queue: Mike Reed <firstname.lastname@example.org>
Reviewed-by: Robert Phillips <email@example.com>
Reviewed-by: Stephan Altmueller <firstname.lastname@example.org>
Simply removed the old definitions of SK_MALLOC_TEMP and SK_MALLOC_THROW.
Copied SK_SUPPORT_LEGACY_MALLOC_PORTING_LAYER into the old defines.
Drop a change where we were not using malloc yet.
These files weren't yet using malloc (and SkBmpBaseCodec hadn't been
These were still using New rather than Make (return raw pointer). Leave
them unchanged, as sk_malloc_flags is still valid.
Leave this unchanged; sk_malloc_flags is still valid
In addition, pull in SkSafeMath.h, which was originally introduced in
https://skia-review.googlesource.com/c/skia/+/33721. This is required
for the new sk_malloc calls.
Also pull in SkSafeMath::Add and SkSafeMath::Mul, introduced in
Also add SK_MaxSizeT, which the above depends on, introduced in
Also, merge SkMalloc.h changes into SkTypes.h, since SkMalloc.h did not
exist in NYC (its functions were in SkTypes.h)
(cherry picked from commit 0f8a0d1cad69056369e3db68fb54d465d30798a5)
14 files changed