From 36f1290ca4b444a7960e8528cc5b8c9b23d53e4d Mon Sep 17 00:00:00 2001 From: "brettw@chromium.org" Date: Wed, 14 Jan 2009 17:15:18 +0000 Subject: Clean up some Skia logging stuff. This unfortunately doesn't re-enable it for the reasons mentioned in the TODO. But I made it work much better when it is enabled. Review URL: http://codereview.chromium.org/17394 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8019 0039d316-1c4b-4281-b951-d872f2087c98 --- skia/include/corecg/SkUserConfig.h | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'skia/include') diff --git a/skia/include/corecg/SkUserConfig.h b/skia/include/corecg/SkUserConfig.h index 3b5885f..34340e1 100644 --- a/skia/include/corecg/SkUserConfig.h +++ b/skia/include/corecg/SkUserConfig.h @@ -87,12 +87,16 @@ #undef SK_SCALAR_IS_FIXED // Log the file and line number for assertions. -#define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, __VA_ARGS__) -void SkDebugf_FileLine(const char* file, int line, const char* format, ...); -#include +#define SkDebugf(...) SkDebugf_FileLine(__FILE__, __LINE__, false, __VA_ARGS__) +void SkDebugf_FileLine(const char* file, int line, bool fatal, + const char* format, ...); + +// Marking the debug print as "fatal" will cause a debug break, so we don't need +// a separate crash call here. #define SK_DEBUGBREAK(cond) do { if (!(cond)) { \ - SkDebugf("%s:%d: failed assertion \"%s\"\n", \ - __FILE__, __LINE__, #cond); SK_CRASH(); } } while (false) + SkDebugf_FileLine(__FILE__, __LINE__, true, \ + "%s:%d: failed assertion \"%s\"\n", \ + __FILE__, __LINE__, #cond); } } while (false) #if defined(SK_BUILD_FOR_WIN32) @@ -150,12 +154,20 @@ typedef unsigned uint32_t; #endif -// FIXME(brettw) re-enable this when we fix the crashes. +// The default crash macro writes to badbeef which can cause some strange +// problems. Instead, pipe this through to the logging function as a fatal +// assertion. +#define SK_CRASH() SkDebugf_FileLine(__FILE__, __LINE__, true, "SK_CRASH") + +// TODO(brettw) bug 6373: Re-enable Skia assertions. This is blocked on fixing +// some of our transparency handling which generates purposely-invalid colors, +// in turn causing assertions. //#ifndef NDEBUG // #define SK_DEBUG // #undef SK_RELEASE -// REMOVE ME -#undef SK_SUPPORT_UNITTEST + #undef SK_SUPPORT_UNITTEST // This is only necessary in debug mode since + // we've disabled assertions. When we re-enable + // them, this line can be removed. //#else #define SK_RELEASE #undef SK_DEBUG -- cgit v1.1