Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: src/ports/SkMemory_malloc.cpp

Issue 1752973003: Only modify abort behavior to avoid debugger dialog on windows for bot builds. (Closed) Base URL: https://skia.googlesource.com/skia@depsos
Patch Set: remove patch dependency Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gyp/common_conditions.gypi ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkTypes.h" 8 #include "SkTypes.h"
9 9
10 #include <stdlib.h> 10 #include <stdlib.h>
11 11
12 #define SK_DEBUGFAILF(fmt, ...) \ 12 #define SK_DEBUGFAILF(fmt, ...) \
13 SkASSERT((SkDebugf(fmt"\n", __VA_ARGS__), false)) 13 SkASSERT((SkDebugf(fmt"\n", __VA_ARGS__), false))
14 14
15 static inline void sk_out_of_memory(size_t size) { 15 static inline void sk_out_of_memory(size_t size) {
16 SK_DEBUGFAILF("sk_out_of_memory (asked for " SK_SIZE_T_SPECIFIER " bytes)", 16 SK_DEBUGFAILF("sk_out_of_memory (asked for " SK_SIZE_T_SPECIFIER " bytes)",
17 size); 17 size);
18 abort(); 18 abort();
19 } 19 }
20 20
21 static inline void* throw_on_failure(size_t size, void* p) { 21 static inline void* throw_on_failure(size_t size, void* p) {
22 if (size > 0 && p == nullptr) { 22 if (size > 0 && p == nullptr) {
23 // If we've got a nullptr here, the only reason we should have failed is running out of RAM. 23 // If we've got a nullptr here, the only reason we should have failed is running out of RAM.
24 sk_out_of_memory(size); 24 sk_out_of_memory(size);
25 } 25 }
26 return p; 26 return p;
27 } 27 }
28 28
29 void sk_abort_no_print() { 29 void sk_abort_no_print() {
30 #ifdef SK_BUILD_FOR_WIN 30 #if defined(SK_BUILD_FOR_WIN) && defined(SK_IS_BOT)
31 // do not display a system dialog before aborting the process 31 // do not display a system dialog before aborting the process
32 _set_abort_behavior(0, _WRITE_ABORT_MSG); 32 _set_abort_behavior(0, _WRITE_ABORT_MSG);
33 #endif 33 #endif
34 abort(); 34 abort();
35 } 35 }
36 36
37 void sk_out_of_memory(void) { 37 void sk_out_of_memory(void) {
38 SkDEBUGFAIL("sk_out_of_memory"); 38 SkDEBUGFAIL("sk_out_of_memory");
39 abort(); 39 abort();
40 } 40 }
(...skipping 21 matching lines...) Expand all
62 } 62 }
63 } 63 }
64 64
65 void* sk_calloc(size_t size) { 65 void* sk_calloc(size_t size) {
66 return calloc(size, 1); 66 return calloc(size, 1);
67 } 67 }
68 68
69 void* sk_calloc_throw(size_t size) { 69 void* sk_calloc_throw(size_t size) {
70 return throw_on_failure(size, sk_calloc(size)); 70 return throw_on_failure(size, sk_calloc(size));
71 } 71 }
OLDNEW
« no previous file with comments | « gyp/common_conditions.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698