mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 920630 - Part 1. Improve image logging to support direct logging of URIs and images objects. r=tnikkel
This commit is contained in:
parent
fade8462cb
commit
f8cf0811d4
@ -8,6 +8,8 @@
|
||||
#define mozilla_image_ImageLogging_h
|
||||
|
||||
#include "mozilla/Logging.h"
|
||||
#include "Image.h"
|
||||
#include "nsIURI.h"
|
||||
#include "prinrval.h"
|
||||
|
||||
static mozilla::LazyLogModule gImgLog("imgRequest");
|
||||
@ -76,6 +78,35 @@ public:
|
||||
paramName, paramValue));
|
||||
}
|
||||
|
||||
/* nsIURI constructor */
|
||||
LogScope(mozilla::LogModule* aLog, void* from, const char* fn,
|
||||
const char* paramName, nsIURI* aURI)
|
||||
: mLog(aLog)
|
||||
, mFrom(from)
|
||||
, mFunc(fn)
|
||||
{
|
||||
if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
|
||||
static const size_t sMaxTruncatedLength = 1024;
|
||||
nsAutoCString spec("<unknown>");
|
||||
if (aURI) {
|
||||
aURI->GetSpec(spec);
|
||||
if (spec.Length() >= sMaxTruncatedLength) {
|
||||
spec.Truncate(sMaxTruncatedLength);
|
||||
}
|
||||
}
|
||||
MOZ_LOG(aLog, LogLevel::Debug, ("%d [this=%p] %s (%s=\"%s\") {ENTER}\n",
|
||||
GIVE_ME_MS_NOW(), from, fn,
|
||||
paramName, spec.get()));
|
||||
}
|
||||
}
|
||||
|
||||
/* Image constructor */
|
||||
LogScope(mozilla::LogModule* aLog, void* from, const char* fn,
|
||||
const char* paramName, mozilla::image::Image* aImage)
|
||||
: LogScope(aLog, from, fn, paramName, aImage ? aImage->GetURI() : nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
~LogScope()
|
||||
{
|
||||
MOZ_LOG(mLog, LogLevel::Debug, ("%d [this=%p] %s {EXIT}\n",
|
||||
@ -121,6 +152,30 @@ public:
|
||||
paramName, paramValue));
|
||||
}
|
||||
|
||||
LogFunc(mozilla::LogModule* aLog, void* from, const char* fn,
|
||||
const char* paramName, nsIURI* aURI)
|
||||
{
|
||||
if (MOZ_LOG_TEST(gImgLog, LogLevel::Debug)) {
|
||||
static const size_t sMaxTruncatedLength = 1024;
|
||||
nsAutoCString spec("<unknown>");
|
||||
if (aURI) {
|
||||
aURI->GetSpec(spec);
|
||||
if (spec.Length() >= sMaxTruncatedLength) {
|
||||
spec.Truncate(sMaxTruncatedLength);
|
||||
}
|
||||
}
|
||||
MOZ_LOG(aLog, LogLevel::Debug, ("%d [this=%p] %s (%s=\"%s\")\n",
|
||||
GIVE_ME_MS_NOW(), from, fn,
|
||||
paramName, spec.get()));
|
||||
}
|
||||
}
|
||||
|
||||
LogFunc(mozilla::LogModule* aLog, void* from, const char* fn,
|
||||
const char* paramName, mozilla::image::Image* aImage)
|
||||
: LogFunc(aLog, from, fn, paramName, aImage ? aImage->GetURI() : nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -16,6 +16,7 @@
|
||||
#include "ImageMetadata.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
#include "nsNetUtil.h" // for NS_NewBufferedInputStream
|
||||
#include "nsStreamUtils.h"
|
||||
#include "OrientedImage.h"
|
||||
#include "SourceBuffer.h"
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include "imgICache.h"
|
||||
#include "imgIContainer.h"
|
||||
#include "imgIEncoder.h"
|
||||
#include "nsNetUtil.h" // for NS_NewBufferedInputStream
|
||||
#include "nsStreamUtils.h"
|
||||
#include "nsStringStream.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
Loading…
Reference in New Issue
Block a user