Bug 936630 - Timeline event sessionRestoreInit. r=ttaubert, r=froydnj

This commit is contained in:
David Rajchenbach-Teller 2014-04-04 08:34:24 -04:00
parent ed5c76a3af
commit f8b93dedfd
4 changed files with 15 additions and 0 deletions

View File

@ -81,6 +81,8 @@ SessionStartup.prototype = {
* Initialize the component
*/
init: function sss_init() {
Services.obs.notifyObservers(null, "sessionstore-init-started", null);
// do not need to initialize anything in auto-started private browsing sessions
if (PrivateBrowsingUtils.permanentPrivateBrowsing) {
this._initialized = true;

View File

@ -242,6 +242,15 @@ add_task(function formdata() {
}
});
add_task(function* test_sessionRestoreInit() {
let info = Cc["@mozilla.org/toolkit/app-startup;1"].
getService(Ci.nsIAppStartup).
getStartupInfo();
ok(info.sessionRestoreInit > info.process, "sessionRestoreInit is after process creation");
ok(info.sessionRestoreInit <
Date.now() + 10000 /* Date.now() is non-monotonic, let's play it paranoid*/,
"sessionRestoreInit is before now");
});
/**
* Get the latest statistics.

View File

@ -13,6 +13,7 @@ mozilla_StartupTimeline_Event(AFTER_PROFILE_LOCKED, "afterProfileLocked")
mozilla_StartupTimeline_Event(STARTUP_CRASH_DETECTION_BEGIN, "startupCrashDetectionBegin")
mozilla_StartupTimeline_Event(STARTUP_CRASH_DETECTION_END, "startupCrashDetectionEnd")
mozilla_StartupTimeline_Event(FIRST_PAINT, "firstPaint")
mozilla_StartupTimeline_Event(SESSION_RESTORE_INIT, "sessionRestoreInit")
mozilla_StartupTimeline_Event(SESSION_RESTORED, "sessionRestored")
mozilla_StartupTimeline_Event(CREATE_TOP_LEVEL_WINDOW, "createTopLevelWindow")
mozilla_StartupTimeline_Event(LINKER_INITIALIZED, "linkerInitialized")

View File

@ -161,6 +161,7 @@ nsAppStartup::Init()
return NS_ERROR_FAILURE;
os->AddObserver(this, "quit-application-forced", true);
os->AddObserver(this, "sessionstore-init-started", true);
os->AddObserver(this, "sessionstore-windows-restored", true);
os->AddObserver(this, "profile-change-teardown", true);
os->AddObserver(this, "xul-window-registered", true);
@ -705,6 +706,8 @@ nsAppStartup::Observe(nsISupports *aSubject,
mPlacesInitCompleteProbe->Trigger();
}
#endif //defined(XP_WIN)
} else if (!strcmp(aTopic, "sessionstore-init-started")) {
StartupTimeline::Record(StartupTimeline::SESSION_RESTORE_INIT);
} else if (!strcmp(aTopic, "xpcom-shutdown")) {
Telemetry::EnteringShutdownStage();
#if defined(XP_WIN)