DescriptionAdd 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
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=227563
Patch Set 1 #
Total comments: 7
Patch Set 2 : unchecked_malloc -> unchecked_alloc #Patch Set 3 : stray whitespace #
Total comments: 5
Patch Set 4 : throwOnFailure -> throw_on_failure #
Messages
Total messages: 17 (0 generated)
|