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
tree: 9e8feccc11eb8e8402a5e14217f4db42c9fe350f
  1. base/
  2. build/
  3. components/
  4. dbus/
  5. ipc/
  6. mojo/
  7. testing/
  8. third_party/
  9. ui/