Bug 946929 - Part 2, adding more temporary diagnostic code. r=roc

This commit is contained in:
Mats Palmgren 2013-12-30 11:17:33 +00:00
Родитель 198efa3a31
Коммит a73ca835cc
1 изменённых файлов: 37 добавлений и 3 удалений

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

@ -70,6 +70,19 @@ using namespace mozilla;
using namespace mozilla::dom;
using namespace mozilla::layers;
// BEGIN temporary diagnostic stuff for bug 946929
struct PCLink;
static PCLink* sTopPCLink;
struct PCLink {
PCLink(const char* w, nsPresContext* aPC)
: prev(sTopPCLink), pc(aPC), where(w) { sTopPCLink = this; }
~PCLink() { sTopPCLink = prev; }
PCLink* prev;
nsPresContext* pc;
const char* where;
};
// END temporary diagnostic stuff for bug 946929
uint8_t gNotifySubDocInvalidationData;
/**
@ -125,7 +138,7 @@ nsPresContext::MakeColorPref(const nsString& aColor)
static void DumpPresContextState(nsPresContext* aPC)
{
printf_stderr("PresContext(%p) ", aPC);
printf_stderr("PresContext(%p) %s", aPC, aPC->IsRoot()?"ROOT ":"");
nsIURI* uri = aPC->Document()->GetDocumentURI();
if (uri) {
nsAutoCString uriSpec;
@ -136,7 +149,7 @@ static void DumpPresContextState(nsPresContext* aPC)
}
nsIPresShell* shell = aPC->GetPresShell();
if (shell) {
printf_stderr("PresShell(%p) - IsDestroying(%i) IsFrozen(%i) IsActive(%i) IsVisible(%i) IsNeverPainting(%i) GetRootFrame(%p)",
printf_stderr("PresShell - IsDestroying(%i) IsFrozen(%i) IsActive(%i) IsVisible(%i) IsNeverPainting(%i) GetRootFrame(%p)",
shell->IsDestroying(),
shell->IsFrozen(),
shell->IsActive(),
@ -156,11 +169,27 @@ nsPresContext::IsDOMPaintEventPending()
if (!GetDisplayRootPresContext() ||
!GetDisplayRootPresContext()->GetRootPresContext()) {
printf_stderr("Failed to find root pres context, dumping pres context and ancestors\n");
for (PCLink* p = sTopPCLink; p; p = p->prev) {
printf_stderr("%s %p ", p->where, p->pc);
}
if (sTopPCLink) printf_stderr("\n");
nsPresContext* pc = this;
for (;;) {
DumpPresContextState(pc);
nsPresContext* parent = pc->GetParentPresContext();
if (!parent)
if (!parent) {
nsIDocument* doc = pc->Document();
if (doc) {
doc = doc->GetParentDocument();
if (doc) {
nsIPresShell* shell = doc->GetShell();
if (shell) {
parent = shell->GetPresContext();
}
}
}
}
if (!parent || parent == pc)
break;
pc = parent;
}
@ -281,6 +310,9 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType)
nsPresContext::~nsPresContext()
{
if (sTopPCLink) {
printf_stderr("~nsPresContext %p %p\n", this, mShell);
}
NS_PRECONDITION(!mShell, "Presshell forgot to clear our mShell pointer");
SetShell(nullptr);
@ -2404,6 +2436,7 @@ NotifyDidPaintSubdocumentCallback(nsIDocument* aDocument, void* aData)
if (shell) {
nsPresContext* pc = shell->GetPresContext();
if (pc) {
PCLink pcl("NotifyDidPaintSubdocumentCallback", pc);
pc->NotifyDidPaintForSubtree(closure->mFlags);
if (pc->IsDOMPaintEventPending()) {
closure->mNeedsAnotherDidPaintNotification = true;
@ -2986,6 +3019,7 @@ NotifyDidPaintForSubtreeCallback(nsITimer *aTimer, void *aClosure)
nsAutoScriptBlocker blockScripts;
// This is a fallback if we don't get paint events for some reason
// so we'll just pretend both layer painting and compositing happened.
PCLink pcl("NotifyDidPaintForSubtreeCallback", presContext);
presContext->NotifyDidPaintForSubtree(
nsIPresShell::PAINT_LAYERS | nsIPresShell::PAINT_COMPOSITE);
}