Bug 1219405 - use LazyLogModule for PNG decoder logging; r=seth

This change eliminates some TSan warnings and also eliminates some
boilerplate.
This commit is contained in:
Nathan Froyd 2015-10-28 16:08:06 -04:00
Родитель ffdbeed5f1
Коммит 77af195199
1 изменённых файлов: 5 добавлений и 22 удалений

Просмотреть файл

@ -24,25 +24,8 @@ using namespace mozilla::gfx;
namespace mozilla { namespace mozilla {
namespace image { namespace image {
static PRLogModuleInfo* static LazyLogModule sPNGLog("PNGDecoder");
GetPNGLog() static LazyLogModule sPNGDecoderAccountingLog("PNGDecoderAccounting");
{
static PRLogModuleInfo* sPNGLog;
if (!sPNGLog) {
sPNGLog = PR_NewLogModule("PNGDecoder");
}
return sPNGLog;
}
static PRLogModuleInfo*
GetPNGDecoderAccountingLog()
{
static PRLogModuleInfo* sPNGDecoderAccountingLog;
if (!sPNGDecoderAccountingLog) {
sPNGDecoderAccountingLog = PR_NewLogModule("PNGDecoderAccounting");
}
return sPNGDecoderAccountingLog;
}
// Limit image dimensions (bug #251381, #591822, and #967656) // Limit image dimensions (bug #251381, #591822, and #967656)
#ifndef MOZ_PNG_MAX_DIMENSION #ifndef MOZ_PNG_MAX_DIMENSION
@ -190,7 +173,7 @@ nsPNGDecoder::CreateFrame(png_uint_32 aXOffset, png_uint_32 aYOffset,
mFrameRect = frameRect; mFrameRect = frameRect;
MOZ_LOG(GetPNGDecoderAccountingLog(), LogLevel::Debug, MOZ_LOG(sPNGDecoderAccountingLog, LogLevel::Debug,
("PNGDecoderAccounting: nsPNGDecoder::CreateFrame -- created " ("PNGDecoderAccounting: nsPNGDecoder::CreateFrame -- created "
"image frame with %dx%d pixels for decoder %p", "image frame with %dx%d pixels for decoder %p",
aWidth, aHeight, this)); aWidth, aHeight, this));
@ -913,7 +896,7 @@ nsPNGDecoder::end_callback(png_structp png_ptr, png_infop info_ptr)
void void
nsPNGDecoder::error_callback(png_structp png_ptr, png_const_charp error_msg) nsPNGDecoder::error_callback(png_structp png_ptr, png_const_charp error_msg)
{ {
MOZ_LOG(GetPNGLog(), LogLevel::Error, ("libpng error: %s\n", error_msg)); MOZ_LOG(sPNGLog, LogLevel::Error, ("libpng error: %s\n", error_msg));
png_longjmp(png_ptr, 1); png_longjmp(png_ptr, 1);
} }
@ -921,7 +904,7 @@ nsPNGDecoder::error_callback(png_structp png_ptr, png_const_charp error_msg)
void void
nsPNGDecoder::warning_callback(png_structp png_ptr, png_const_charp warning_msg) nsPNGDecoder::warning_callback(png_structp png_ptr, png_const_charp warning_msg)
{ {
MOZ_LOG(GetPNGLog(), LogLevel::Warning, ("libpng warning: %s\n", warning_msg)); MOZ_LOG(sPNGLog, LogLevel::Warning, ("libpng warning: %s\n", warning_msg));
} }
Telemetry::ID Telemetry::ID