Bug 718737 - Add a startup timeline event on the first nsDocShell::LoadURI for non about:blank content. r=bz,r=tglek

This commit is contained in:
Mike Hommey 2012-01-19 08:40:18 +01:00
parent 58a32c337f
commit c4e4acd545
2 changed files with 14 additions and 3 deletions

View File

@ -224,6 +224,7 @@
#include "nsDOMNavigationTiming.h"
#include "nsITimedChannel.h"
#include "mozilla/StartupTimeline.h"
static NS_DEFINE_CID(kDOMScriptObjectFactoryCID,
NS_DOM_SCRIPT_OBJECT_FACTORY_CID);
@ -1224,6 +1225,11 @@ nsDocShell::LoadURI(nsIURI * aURI,
NS_ENSURE_ARG(aURI);
if (!StartupTimeline::HasRecord(StartupTimeline::FIRST_LOAD_URI) &&
mItemType == typeContent && !NS_IsAboutBlank(aURI)) {
StartupTimeline::RecordOnce(StartupTimeline::FIRST_LOAD_URI);
}
// Extract the info from the DocShellLoadInfo struct...
if (aLoadInfo) {
aLoadInfo->GetReferrer(getter_AddRefs(referrer));

View File

@ -43,6 +43,7 @@ mozilla_StartupTimeline_Event(SESSION_RESTORED, "sessionRestored")
mozilla_StartupTimeline_Event(CREATE_TOP_LEVEL_WINDOW, "createTopLevelWindow")
mozilla_StartupTimeline_Event(LINKER_INITIALIZED, "linkerInitialized")
mozilla_StartupTimeline_Event(LIBRARIES_LOADED, "librariesLoaded")
mozilla_StartupTimeline_Event(FIRST_LOAD_URI, "firstLoadURI")
#else
#ifndef mozilla_StartupTimeline
@ -74,9 +75,13 @@ public:
sStartupTimeline[ev] = when;
}
static void RecordOnce(Event ev, PRTime when = PR_Now()) {
if (!sStartupTimeline[ev])
sStartupTimeline[ev] = when;
static void RecordOnce(Event ev) {
if (!HasRecord(ev))
sStartupTimeline[ev] = PR_Now();
}
static bool HasRecord(Event ev) {
return sStartupTimeline[ev];
}
private: