Backed out changeset 4c2ec5c33ea9 (bug 911146)

This commit is contained in:
Tim Taubert 2013-09-11 04:53:01 +02:00
parent 2f750ee588
commit 091a950e0d
3 changed files with 11 additions and 35 deletions

View File

@ -363,9 +363,6 @@ nsAppStartup::Quit(uint32_t aMode)
}
if (mRestart) {
// Mark the next startup as a restart.
PR_SetEnv("MOZ_APP_RESTART=1");
/* Firefox-restarts reuse the process so regular process start-time isn't
a useful indicator of startup time anymore. */
TimeStamp::RecordProcessRestart();
@ -525,19 +522,6 @@ nsAppStartup::GetRestarting(bool *aResult)
return NS_OK;
}
NS_IMETHODIMP
nsAppStartup::GetWasRestarted(bool *aResult)
{
char *mozAppRestart = PR_GetEnv("MOZ_APP_RESTART");
/* When calling PR_SetEnv() with an empty value the existing variable may
* be unset or set to the empty string depending on the underlying platform
* thus we have to check if the variable is present and not empty. */
*aResult = mozAppRestart && (strcmp(mozAppRestart, "") != 0);
return NS_OK;
}
NS_IMETHODIMP
nsAppStartup::SetInterrupted(bool aInterrupted)
{

View File

@ -7,7 +7,7 @@
interface nsICmdLineService;
[scriptable, uuid(744d6ec0-115f-11e3-9c94-68fd99890b3c)]
[scriptable, uuid(380618f8-479a-435b-b58e-7398ab937531)]
interface nsIAppStartup : nsISupports
{
/**
@ -140,12 +140,6 @@ interface nsIAppStartup : nsISupports
*/
readonly attribute boolean restarting;
/**
* True if this is the startup following restart, i.e. if the application
* was restarted using quit(eRestart*).
*/
readonly attribute boolean wasRestarted;
/**
* Returns an object with main, process, firstPaint, sessionRestored properties.
* Properties may not be available depending on platform or application

View File

@ -9,9 +9,7 @@
*/
#include "mozilla/TimeStamp.h"
#include "nsCOMPtr.h"
#include "nsServiceManagerUtils.h"
#include "nsIAppStartup.h"
#include "prenv.h"
namespace mozilla {
@ -24,18 +22,17 @@ TimeStamp::ProcessCreation(bool& aIsInconsistent)
aIsInconsistent = false;
if (sProcessCreation.IsNull()) {
char *mozAppRestart = PR_GetEnv("MOZ_APP_RESTART");
TimeStamp ts;
// Ask the startup service whether the app was restarted.
nsCOMPtr<nsIAppStartup> appService =
do_GetService("@mozilla.org/toolkit/app-startup;1");
bool wasRestarted;
appService->GetWasRestarted(&wasRestarted);
if (wasRestarted) {
/* Firefox was restarted, use the first time-stamp we've
* taken as the new process startup time. */
/* When calling PR_SetEnv() with an empty value the existing variable may
* be unset or set to the empty string depending on the underlying platform
* thus we have to check if the variable is present and not empty. */
if (mozAppRestart && (strcmp(mozAppRestart, "") != 0)) {
/* Firefox was restarted, use the first time-stamp we've taken as the new
* process startup time and unset MOZ_APP_RESTART. */
ts = sFirstTimeStamp;
PR_SetEnv("MOZ_APP_RESTART=");
} else {
TimeStamp now = Now();
uint64_t uptime = ComputeProcessUptime();
@ -60,6 +57,7 @@ TimeStamp::ProcessCreation(bool& aIsInconsistent)
void
TimeStamp::RecordProcessRestart()
{
PR_SetEnv("MOZ_APP_RESTART=1");
sProcessCreation = TimeStamp();
}