Bug 934719 - log load begin and end in presshell. r=heycam

This commit is contained in:
John Daggett 2013-11-05 10:03:22 +09:00
parent b33da98ea4
commit f6e7f6ca8c
2 changed files with 39 additions and 2 deletions

View File

@ -18,6 +18,11 @@
/* a presentation of a document, part 2 */
#ifdef MOZ_LOGGING
#define FORCE_PR_LOG /* Allow logging in the release build */
#endif
#include "prlog.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/dom/TabChild.h"
#include "mozilla/Likely.h"
@ -44,7 +49,6 @@
#include "nsViewManager.h"
#include "nsView.h"
#include "nsCRTGlue.h"
#include "prlog.h"
#include "prprf.h"
#include "prinrval.h"
#include "nsTArray.h"
@ -681,8 +685,10 @@ PresShell::PresShell()
mReflowCountMgr->SetPresShell(this);
#endif
#ifdef PR_LOGGING
if (! gLog)
mLoadBegin = TimeStamp::Now();
if (!gLog) {
gLog = PR_NewLogModule("PresShell");
}
#endif
mSelectionFlags = nsISelectionDisplay::DISPLAY_TEXT | nsISelectionDisplay::DISPLAY_IMAGES;
mIsThemeSupportDisabled = false;
@ -2391,6 +2397,20 @@ void
PresShell::BeginLoad(nsIDocument *aDocument)
{
mDocumentLoading = true;
#ifdef PR_LOGGING
if (gLog && PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
mLoadBegin = TimeStamp::Now();
nsIURI* uri = mDocument->GetDocumentURI();
nsAutoCString spec;
if (uri) {
uri->GetSpec(spec);
}
PR_LOG(gLog, PR_LOG_DEBUG,
("(presshell) %p begin load [%s]\n",
this, spec.get()));
}
#endif
}
void
@ -2401,6 +2421,21 @@ PresShell::EndLoad(nsIDocument *aDocument)
RestoreRootScrollPosition();
mDocumentLoading = false;
#ifdef PR_LOGGING
// log load
if (gLog && PR_LOG_TEST(gLog, PR_LOG_DEBUG)) {
TimeDuration loadTime = TimeStamp::Now() - mLoadBegin;
nsIURI* uri = mDocument->GetDocumentURI();
nsAutoCString spec;
if (uri) {
uri->GetSpec(spec);
}
PR_LOG(gLog, PR_LOG_DEBUG,
("(presshell) %p end load time-ms: %9.2f [%s]\n",
this, loadTime.ToMilliseconds(), spec.get()));
}
#endif
}
#ifdef DEBUG

View File

@ -756,6 +756,8 @@ protected:
// The `performance.now()` value when we last started to process reflows.
DOMHighResTimeStamp mLastReflowStart;
mozilla::TimeStamp mLoadBegin; // used to time loads
// Information needed to properly handle scrolling content into view if the
// pre-scroll reflow flush can be interrupted. mContentToScrollTo is
// non-null between the initial scroll attempt and the first time we finish