Add sk_calloc and sk_calloc_throw to SkMemory_new_handler.cpp.
After finding that calloc can be significantly faster than malloc+bzero on some
platforms (notably, Android), Skia wants to start experimenting with using
calloc where possible. For this, we've added sk_calloc and sk_calloc_throw to
the SkMemory API.
This CL is my ham-handed approach to add calloc support to
SkMemory_new_handler.cpp. It seems to me that this exists as an alternative to
SkMemory_malloc.cpp so that we can try to dodge any OOM crash that the
underlying malloc implementation might helpfully provide?
I've tried to mimic what I saw here for the non-throwing malloc onto sk_calloc,
and just did some refactoring to make this code look a bit more like the
current SkMemory_malloc.cpp.
BUG=skia:1662
Review URL: https://codereview.chromium.org/23455061
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@227563 0039d316-1c4b-4281-b951-d872f2087c98
CrOS-Libchrome-Original-Commit: 26d915cdb52034b90c2fd13eb9340df0c74e2fe2
1 file changed