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

Side by Side Diff: include/core/SkPostConfig.h

Issue 1620333002: Revert of Consolidate SK_CRASH and sk_throw into SK_ABORT (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « include/config/SkUserConfig.h ('k') | include/core/SkTArray.h » ('j') | 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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 // IWYU pragma: private, include "SkTypes.h" 8 // IWYU pragma: private, include "SkTypes.h"
9 9
10 #ifndef SkPostConfig_DEFINED 10 #ifndef SkPostConfig_DEFINED
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 # else 96 # else
97 # define SkNO_RETURN_HINT() do {} while (false) 97 # define SkNO_RETURN_HINT() do {} while (false)
98 # endif 98 # endif
99 #endif 99 #endif
100 100
101 /////////////////////////////////////////////////////////////////////////////// 101 ///////////////////////////////////////////////////////////////////////////////
102 102
103 // TODO(mdempsky): Move elsewhere as appropriate. 103 // TODO(mdempsky): Move elsewhere as appropriate.
104 #include <new> 104 #include <new>
105 105
106 #ifndef SK_CRASH
107 # ifdef SK_BUILD_FOR_WIN
108 # define SK_CRASH() __debugbreak()
109 # else
110 # if 1 // set to 0 for infinite loop, which can help connecting gdb
111 # define SK_CRASH() do { SkNO_RETURN_HINT(); *(int *)(uintptr_t)0xbbadbeef = 0; } while (false)
112 # else
113 # define SK_CRASH() do { SkNO_RETURN_HINT(); } while (true)
114 # endif
115 # endif
116 #endif
106 117
107 /////////////////////////////////////////////////////////////////////////////// 118 ///////////////////////////////////////////////////////////////////////////////
108 119
109 #ifdef SK_BUILD_FOR_WIN 120 #ifdef SK_BUILD_FOR_WIN
110 # ifndef WIN32_LEAN_AND_MEAN 121 # ifndef WIN32_LEAN_AND_MEAN
111 # define WIN32_LEAN_AND_MEAN 122 # define WIN32_LEAN_AND_MEAN
112 # define WIN32_IS_MEAN_WAS_LOCALLY_DEFINED 123 # define WIN32_IS_MEAN_WAS_LOCALLY_DEFINED
113 # endif 124 # endif
114 # ifndef NOMINMAX 125 # ifndef NOMINMAX
115 # define NOMINMAX 126 # define NOMINMAX
(...skipping 14 matching lines...) Expand all
130 # ifndef SK_A32_SHIFT 141 # ifndef SK_A32_SHIFT
131 # define SK_A32_SHIFT 24 142 # define SK_A32_SHIFT 24
132 # define SK_R32_SHIFT 16 143 # define SK_R32_SHIFT 16
133 # define SK_G32_SHIFT 8 144 # define SK_G32_SHIFT 8
134 # define SK_B32_SHIFT 0 145 # define SK_B32_SHIFT 0
135 # endif 146 # endif
136 # 147 #
137 #endif 148 #endif
138 149
139 #if defined(GOOGLE3) 150 #if defined(GOOGLE3)
151 // Used as argument to DumpStackTrace in SK_ALWAYSBREAK.
140 void SkDebugfForDumpStackTrace(const char* data, void* unused); 152 void SkDebugfForDumpStackTrace(const char* data, void* unused);
141 void DumpStackTrace(int skip_count, void w(const char*, void*), void* arg);
142 # define SK_DUMP_GOOGLE3_STACK() DumpStackTrace(0, SkDebugfForDumpStackTrace, n ullptr)
143 #else
144 # define SK_DUMP_GOOGLE3_STACK()
145 #endif 153 #endif
146 154
147 #ifndef SK_ABORT 155 #ifndef SK_ALWAYSBREAK
148 # define SK_ABORT(msg) \ 156 # if defined(GOOGLE3)
149 do { \ 157 void DumpStackTrace(int skip_count, void w(const char*, void*),
150 SkNO_RETURN_HINT(); \ 158 void* arg);
151 SkDebugf("%s:%d: fatal error: \"%s\"\n", __FILE__, __LINE__, #msg); \ 159 # define SK_ALWAYSBREAK(cond) do { \
152 SK_DUMP_GOOGLE3_STACK(); \ 160 if (cond) break; \
153 sk_abort_no_print(); \ 161 SkNO_RETURN_HINT(); \
154 } while (false) 162 SkDebugf("%s:%d: failed assertion \"%s\"\n", __FILE__, __LINE__, # cond); \
163 DumpStackTrace(0, SkDebugfForDumpStackTrace, nullptr); \
164 SK_CRASH(); \
165 } while (false)
166 # elif defined(SK_DEBUG)
167 # define SK_ALWAYSBREAK(cond) do { \
168 if (cond) break; \
169 SkNO_RETURN_HINT(); \
170 SkDebugf("%s:%d: failed assertion \"%s\"\n", __FILE__, __LINE__, # cond); \
171 SK_CRASH(); \
172 } while (false)
173 # else
174 # define SK_ALWAYSBREAK(cond) do { if (cond) break; SK_CRASH(); } while (fals e)
175 # endif
155 #endif 176 #endif
156 177
157 /** 178 /**
158 * We check to see if the SHIFT value has already been defined. 179 * We check to see if the SHIFT value has already been defined.
159 * if not, we define it ourself to some default values. We default to OpenGL 180 * if not, we define it ourself to some default values. We default to OpenGL
160 * order (in memory: r,g,b,a) 181 * order (in memory: r,g,b,a)
161 */ 182 */
162 #ifndef SK_A32_SHIFT 183 #ifndef SK_A32_SHIFT
163 # ifdef SK_CPU_BENDIAN 184 # ifdef SK_CPU_BENDIAN
164 # define SK_R32_SHIFT 24 185 # define SK_R32_SHIFT 24
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 # define SK_GAMMA_EXPONENT (2.2f) 359 # define SK_GAMMA_EXPONENT (2.2f)
339 #endif 360 #endif
340 361
341 ////////////////////////////////////////////////////////////////////// 362 //////////////////////////////////////////////////////////////////////
342 363
343 #ifndef GR_TEST_UTILS 364 #ifndef GR_TEST_UTILS
344 # define GR_TEST_UTILS 1 365 # define GR_TEST_UTILS 1
345 #endif 366 #endif
346 367
347 #endif // SkPostConfig_DEFINED 368 #endif // SkPostConfig_DEFINED
OLDNEW
« no previous file with comments | « include/config/SkUserConfig.h ('k') | include/core/SkTArray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698