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

Unified Diff: include/core/SkTypes.h

Issue 1610823002: Consolidate SK_CRASH and sk_throw into SK_ABORT (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: windows fix 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkTArray.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkTypes.h
diff --git a/include/core/SkTypes.h b/include/core/SkTypes.h
index c112b0364f1ab59967e97d40790b59532a20d397..0d31efc6ccf7dd904dd7232b094aedaddbbc6870 100644
--- a/include/core/SkTypes.h
+++ b/include/core/SkTypes.h
@@ -67,7 +67,7 @@ SK_API extern void sk_out_of_memory(void);
The platform implementation must not return, but should either throw
an exception or otherwise exit.
*/
-SK_API extern void sk_throw(void);
+SK_API extern void sk_abort_no_print(void);
enum {
SK_MALLOC_TEMP = 0x01, //!< hint to sk_malloc that the requested memory will be freed in the scope of the stack frame
@@ -128,8 +128,10 @@ inline void operator delete(void* p) {
SK_API void SkDebugf(const char format[], ...);
#endif
+#define SkASSERT_RELEASE(cond) if(!(cond)) { SK_ABORT(#cond); }
+
#ifdef SK_DEBUG
- #define SkASSERT(cond) SK_ALWAYSBREAK(cond)
+ #define SkASSERT(cond) SkASSERT_RELEASE(cond)
#define SkDEBUGFAIL(message) SkASSERT(false && message)
#define SkDEBUGFAILF(fmt, ...) SkASSERTF(false, fmt, ##__VA_ARGS__)
#define SkDEBUGCODE(code) code
@@ -150,7 +152,9 @@ inline void operator delete(void* p) {
#define SkAssertResult(cond) cond
#endif
-#define SkFAIL(message) SK_ALWAYSBREAK(false && message)
+// Legacy macro names for SK_ABORT
+#define SkFAIL(message) SK_ABORT(message)
+#define sk_throw() SK_ABORT("sk_throw")
// We want to evaluate cond only once, and inside the SkASSERT somewhere so we see its string form.
// So we use the comma operator to make an SkDebugf that always returns false: we'll evaluate cond,
« no previous file with comments | « include/core/SkTArray.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698