OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * Copyright 2012 Mozilla Foundation | 3 * Copyright 2012 Mozilla Foundation |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "SkTypes.h" | 9 #include "SkTypes.h" |
10 | 10 |
11 #include "mozilla/mozalloc.h" | 11 #include "mozilla/mozalloc.h" |
12 #include "mozilla/mozalloc_abort.h" | 12 #include "mozilla/mozalloc_abort.h" |
13 #include "mozilla/mozalloc_oom.h" | 13 #include "mozilla/mozalloc_oom.h" |
14 | 14 |
15 void sk_throw() { | 15 void sk_abort_no_print() { |
16 SkDEBUGFAIL("sk_throw"); | 16 mozalloc_abort("Abort from sk_abort"); |
17 mozalloc_abort("Abort from sk_throw"); | |
18 } | 17 } |
19 | 18 |
20 void sk_out_of_memory(void) { | 19 void sk_out_of_memory(void) { |
21 SkDEBUGFAIL("sk_out_of_memory"); | 20 SkDEBUGFAIL("sk_out_of_memory"); |
22 mozalloc_handle_oom(0); | 21 mozalloc_handle_oom(0); |
23 } | 22 } |
24 | 23 |
25 void* sk_malloc_throw(size_t size) { | 24 void* sk_malloc_throw(size_t size) { |
26 return sk_malloc_flags(size, SK_MALLOC_THROW); | 25 return sk_malloc_flags(size, SK_MALLOC_THROW); |
27 } | 26 } |
(...skipping 10 matching lines...) Expand all Loading... |
38 return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : malloc(size); | 37 return (flags & SK_MALLOC_THROW) ? moz_xmalloc(size) : malloc(size); |
39 } | 38 } |
40 | 39 |
41 void* sk_calloc(size_t size) { | 40 void* sk_calloc(size_t size) { |
42 return calloc(size, 1); | 41 return calloc(size, 1); |
43 } | 42 } |
44 | 43 |
45 void* sk_calloc_throw(size_t size) { | 44 void* sk_calloc_throw(size_t size) { |
46 return moz_xcalloc(size, 1); | 45 return moz_xcalloc(size, 1); |
47 } | 46 } |
OLD | NEW |