about:startup - final review hurdle, add _MOZILLA_2_0 interfaces to contain the additions to nsIXULRuntime and nsIXULAppInfo

This commit is contained in:
Daniel Brooks 2010-12-07 02:28:12 -06:00
parent 32ebda96aa
commit a7dc249655
6 changed files with 30 additions and 10 deletions

View File

@ -114,14 +114,23 @@ interface nsIAppStartup : nsISupports
void quit(in PRUint32 aMode);
};
[scriptable, uuid(079594bc-fcfd-4da7-b46f-4dcaf4bd929e)]
[scriptable, uuid(e233d663-d014-43b0-8649-7145ecf0a0b1)]
interface nsIAppStartup2 : nsIAppStartup
{
/**
* True if the application is in the process of shutting down.
*/
readonly attribute boolean shuttingDown;
};
[scriptable, uuid(079594bc-fcfd-4da7-b46f-4dcaf4bd929e)]
interface nsIAppStartup_MOZILLA_2_0 : nsIAppStartup2
{
/**
* Recorded timestamp indicating when app startup finished and the
* app was ready for user input (session restore finished, in
* Firefox)
*/
readonly attribute PRUint64 restoredTimestamp;
};

7
toolkit/components/startup/src/nsAppStartup.cpp Normal file → Executable file
View File

@ -152,9 +152,10 @@ nsAppStartup::Init()
// nsAppStartup->nsISupports
//
NS_IMPL_THREADSAFE_ISUPPORTS6(nsAppStartup,
NS_IMPL_THREADSAFE_ISUPPORTS7(nsAppStartup,
nsIAppStartup,
nsIAppStartup2,
nsIAppStartup_MOZILLA_2_0,
nsIWindowCreator,
nsIWindowCreator2,
nsIObserver,
@ -540,8 +541,8 @@ nsresult nsAppStartup::RecordStartupDuration()
PRTime launched = 0, started = 0;
mRestoredTimestamp = PR_Now();
nsCOMPtr<nsIXULRuntime> runtime = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
nsCOMPtr<nsIXULAppInfo> appinfo = do_QueryInterface(runtime);
nsCOMPtr<nsIXULAppInfo> appinfo = do_GetService(XULRUNTIME_SERVICE_CONTRACTID);
nsCOMPtr<nsIXULRuntime_MOZILLA_2_0> runtime = do_QueryInterface(appinfo);
runtime->GetLaunchTimestamp(reinterpret_cast<PRUint64*>(&launched));
runtime->GetStartupTimestamp(reinterpret_cast<PRUint64*>(&started));

3
toolkit/components/startup/src/nsAppStartup.h Normal file → Executable file
View File

@ -55,7 +55,7 @@ struct PLEvent;
{ 0x7dd4d320, 0xc84b, 0x4624, { 0x8d, 0x45, 0x7b, 0xb9, 0xb2, 0x35, 0x69, 0x77 } }
class nsAppStartup : public nsIAppStartup2,
class nsAppStartup : public nsIAppStartup_MOZILLA_2_0,
public nsIWindowCreator2,
public nsIObserver,
public nsSupportsWeakReference
@ -64,6 +64,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIAPPSTARTUP
NS_DECL_NSIAPPSTARTUP2
NS_DECL_NSIAPPSTARTUP_MOZILLA_2_0
NS_DECL_NSIWINDOWCREATOR
NS_DECL_NSIWINDOWCREATOR2
NS_DECL_NSIOBSERVER

View File

@ -96,16 +96,18 @@ function clamp(min, value, max) Math.max(min, (Math.min(value, max)));
///// First, display the timings from the current startup
let launched, startup, restored;
let runtime = Services.appinfo;
runtime.QueryInterface(Ci.nsIXULRuntime_MOZILLA_2_0);
try {
displayTimestamp("launched", launched = Services.appinfo.launchTimestamp);
displayTimestamp("launched", launched = runtime.launchTimestamp);
} catch(x) { }
displayTimestamp("started", startup = Services.appinfo.startupTimestamp);
displayTimestamp("started", startup = runtime.startupTimestamp);
if (launched)
displayDuration("started", startup - launched);
let app = Cc["@mozilla.org/toolkit/app-startup;1"]
.getService(Ci.nsIAppStartup2);
.getService(Ci.nsIAppStartup_MOZILLA_2_0);
displayTimestamp("restored", restored = app.restoredTimestamp);
displayDuration("restored", restored - startup);

View File

@ -613,13 +613,15 @@ class nsXULAppInfo : public nsIXULAppInfo,
#ifdef MOZ_CRASHREPORTER
public nsICrashReporter,
#endif
public nsIXULRuntime
public nsIXULRuntime,
public nsIXULRuntime_MOZILLA_2_0
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIXULAPPINFO
NS_DECL_NSIXULRUNTIME
NS_DECL_NSIXULRUNTIME_MOZILLA_2_0
#ifdef MOZ_CRASHREPORTER
NS_DECL_NSICRASHREPORTER
#endif
@ -631,6 +633,7 @@ public:
NS_INTERFACE_MAP_BEGIN(nsXULAppInfo)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXULRuntime)
NS_INTERFACE_MAP_ENTRY(nsIXULRuntime)
NS_INTERFACE_MAP_ENTRY(nsIXULRuntime_MOZILLA_2_0)
#ifdef XP_WIN
NS_INTERFACE_MAP_ENTRY(nsIWinAppHelper)
#endif

View File

@ -44,7 +44,7 @@
* stable/frozen, please contact Benjamin Smedberg.
*/
[scriptable, uuid(a79a4031-9590-496c-b005-96b8542591ef)]
[scriptable, uuid(7685dac8-3637-4660-a544-928c5ec0e714)]
interface nsIXULRuntime : nsISupports
{
/**
@ -116,7 +116,11 @@ interface nsIXULRuntime : nsISupports
* @throw NS_ERROR_NOT_AVAILABLE if not available.
*/
void ensureContentProcess();
};
[scriptable, uuid(a79a4031-9590-496c-b005-96b8542591ef)]
interface nsIXULRuntime_MOZILLA_2_0 : nsISupports
{
/**
* Recorded timestamp indicating when the operating system began launching the app
*/