about:startup - final review hurdle, add _MOZILLA_2_0 interfaces to contain the additions to nsIXULRuntime and nsIXULAppInfo
authorDaniel Brooks <db48x@db48x.net>
Tue, 07 Dec 2010 02:28:12 -0600
changeset 58875 bc85e9f6df4e1256dec3c5222ded7d24baa16d75
parent 58874 292bd8571d7c4ea5bc730ebab1c7e6139bf9bfdc
child 58876 a89f24bf179869eab5697ac82c0c42b626d87e4c
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
milestone2.0b8pre
about:startup - final review hurdle, add _MOZILLA_2_0 interfaces to contain the additions to nsIXULRuntime and nsIXULAppInfo
toolkit/components/startup/public/nsIAppStartup.idl
toolkit/components/startup/src/nsAppStartup.cpp
toolkit/components/startup/src/nsAppStartup.h
toolkit/content/aboutStartup.js
toolkit/xre/nsAppRunner.cpp
xpcom/system/nsIXULRuntime.idl
--- a/toolkit/components/startup/public/nsIAppStartup.idl
+++ b/toolkit/components/startup/public/nsIAppStartup.idl
@@ -109,24 +109,33 @@ interface nsIAppStartup : nsISupports
      *
      * @param aMode
      *        This parameter modifies how the app is shutdown, and it is
      *        constructed from the constants defined above.
      */
     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;
 };
 
 %{C++
 /**
  * This success code may be returned by nsIAppStartup::Run to indicate that the
  * application should be restarted.  This condition corresponds to the case in
  * which nsIAppStartup::Quit was called with the eRestart flag.
old mode 100644
new mode 100755
--- a/toolkit/components/startup/src/nsAppStartup.cpp
+++ b/toolkit/components/startup/src/nsAppStartup.cpp
@@ -147,19 +147,20 @@ nsAppStartup::Init()
   return NS_OK;
 }
 
 
 //
 // nsAppStartup->nsISupports
 //
 
-NS_IMPL_THREADSAFE_ISUPPORTS6(nsAppStartup,
+NS_IMPL_THREADSAFE_ISUPPORTS7(nsAppStartup,
                               nsIAppStartup,
                               nsIAppStartup2,
+                              nsIAppStartup_MOZILLA_2_0,
                               nsIWindowCreator,
                               nsIWindowCreator2,
                               nsIObserver,
                               nsISupportsWeakReference)
 
 
 //
 // nsAppStartup->nsIAppStartup
@@ -535,18 +536,18 @@ nsAppStartup::Observe(nsISupports *aSubj
 }
 
 nsresult nsAppStartup::RecordStartupDuration()
 {
   nsresult rv;
   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));
 
   if (!launched)
   {
     launched = started;
   }
old mode 100644
new mode 100755
--- a/toolkit/components/startup/src/nsAppStartup.h
+++ b/toolkit/components/startup/src/nsAppStartup.h
@@ -50,25 +50,26 @@
 
 struct PLEvent;
 
 // {7DD4D320-C84B-4624-8D45-7BB9B2356977}
 #define NS_TOOLKIT_APPSTARTUP_CID \
 { 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
 {
 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
 
   nsAppStartup();
   nsresult Init();
 
 private:
--- a/toolkit/content/aboutStartup.js
+++ b/toolkit/content/aboutStartup.js
@@ -91,26 +91,28 @@ function majorMark(x, l) label(major(mar
 function minorMark(x, l) label(minor(mark(range(x))), l);
 function extensionMark(x, l) label(green(mark(range(x))), l);
 
 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);
 
 ///// Next, load the database
 var file = Services.dirsvc.get("ProfD", Components.interfaces.nsIFile);
 file.append("startup.sqlite");
 
 var db = Services.storage.openDatabase(file);
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -608,34 +608,37 @@ PRBool gSafeMode = PR_FALSE;
  */
 class nsXULAppInfo : public nsIXULAppInfo,
 #ifdef XP_WIN
                      public nsIWinAppHelper,
 #endif
 #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
 #ifdef XP_WIN
   NS_DECL_NSIWINAPPHELPER
 #endif
 };
 
 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
 #ifdef MOZ_CRASHREPORTER
   NS_INTERFACE_MAP_ENTRY(nsICrashReporter)
 #endif
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIXULAppInfo, gAppData)
 NS_INTERFACE_MAP_END
--- a/xpcom/system/nsIXULRuntime.idl
+++ b/xpcom/system/nsIXULRuntime.idl
@@ -39,17 +39,17 @@
 
 /**
  * Provides information about the XUL runtime.
  * @status UNSTABLE - This interface is not frozen and will probably change in
  *                    future releases. If you need this functionality to be
  *                    stable/frozen, please contact Benjamin Smedberg.
  */
 
-[scriptable, uuid(a79a4031-9590-496c-b005-96b8542591ef)]
+[scriptable, uuid(7685dac8-3637-4660-a544-928c5ec0e714)]
 interface nsIXULRuntime : nsISupports
 {
   /**
    * Whether the application was launched in safe mode.
    */
   readonly attribute boolean inSafeMode;
 
   /**
@@ -111,17 +111,21 @@ interface nsIXULRuntime : nsISupports
   /**
    * Starts a child process. This method is intented to pre-start a
    * content child process so that when it is actually needed, it is
    * ready to go.
    *
    * @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
     */
   readonly attribute unsigned long long launchTimestamp;
 
   /**
    * Recorded timestamp indicating when app startup began (essentially XRE_Main)
     */