Commit f775e465 authored by Ben Wagner's avatar Ben Wagner Committed by Commit Bot

Better handle SK_ABORT.

The Chromium logging of SkDebugf messages was originally intended to be
INFO, but was sometimes changed to ERROR because otherwise the SkDebugf
in SK_ABORT was not logged, making crashes more difficult to diagnose.
This was done with https://crrev.com/c/1348630 but this leads to all
SkDebugf calls being logged as ERROR when DCHECK_IS_ON.

Instead, restore SkDebugf messages to INFO and define SK_ABORT directly
and define it to work the way it is expected to work, as a FATAL message
which aborts.

Bug: chromium:1050863
Change-Id: If4c5525cd3f0ee762ed9a95c22148970e6962dd5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2316816
Commit-Queue: Ben Wagner <bungeman@chromium.org>
Reviewed-by: default avatarBrian Salomon <bsalomon@google.com>
Cr-Commit-Position: refs/heads/master@{#791460}
parent a8184b17
......@@ -151,6 +151,13 @@ SK_API void SkDebugf_FileLine(const char* file,
const char* format,
...);
#define SK_ABORT(format, ...) SkAbort_FileLine(__FILE__, __LINE__, \
format,##__VA_ARGS__)
[[noreturn]] SK_API void SkAbort_FileLine(const char* file,
int line,
const char* format,
...);
#if !defined(ANDROID) // On Android, we use the skia default settings.
#define SK_A32_SHIFT 24
#define SK_R32_SHIFT 16
......
......@@ -11,11 +11,7 @@
#include "third_party/skia/include/core/SkTypes.h"
void SkDebugf_FileLine(const char* file, int line, const char* format, ...) {
#if DCHECK_IS_ON()
int severity = logging::LOG_ERROR;
#else
int severity = logging::LOG_INFO;
#endif
if (severity < logging::GetMinLogLevel())
return;
......@@ -28,3 +24,19 @@ void SkDebugf_FileLine(const char* file, int line, const char* format, ...) {
logging::LogMessage(file, line, severity).stream() << msg;
}
void SkAbort_FileLine(const char* file, int line, const char* format, ...) {
int severity = logging::LOG_FATAL;
va_list ap;
va_start(ap, format);
std::string msg;
base::StringAppendV(&msg, format, ap);
va_end(ap);
logging::LogMessage(file, line, severity).stream() << msg;
sk_abort_no_print();
// Extra safety abort().
abort();
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment