Add sk_malloc_size() to query usable allocation sizes

The implementation in SkContainers.cpp tries to use a platform-dependent
way of figuring out the actual size allocated for a memory block, but
when using a custom allocator it should not assume how to obtain this
information. Instead, add a sk_malloc_size() function that custom
allocators can implement.

Existing code gets moved to SkMemory_{malloc,mozalloc}.cpp into their
respective sk_malloc_size() implementations.

Change-Id: I4c8f23cbcc03ec9384104a7985a11df15584f583
Bug: b/325991359
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/816036
Reviewed-by: Leon Scroggins <scroggo@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Brian Osman <brianosman@google.com>
Reviewed-by: Ben Wagner <bungeman@google.com>
Auto-Submit: Adrian Perez de Castro <aperez@igalia.com>
4 files changed