about:startup - wrap some things at 80 columns, even though it's not always strictly an improvement
authorDaniel Brooks <db48x@db48x.net>
Sun, 19 Sep 2010 12:42:08 -0400
changeset 58851 76c3a602011f97d3f3d7170a0670db2c599eb9a5
parent 58850 201318cf1908440de996ad1977846702ad4e141f
child 58852 6d5c509f974349280fb73a1ee497ad209c669e2d
push id17440
push userdb48x@yahoo.com
push dateWed, 08 Dec 2010 04:15:54 +0000
treeherdermozilla-central@a89f24bf1798 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0b6pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
about:startup - wrap some things at 80 columns, even though it's not always strictly an improvement
toolkit/components/startup/src/nsAppStartup.cpp
toolkit/content/aboutStartup.js
toolkit/content/aboutStartup.xhtml
--- a/toolkit/components/startup/src/nsAppStartup.cpp
+++ b/toolkit/components/startup/src/nsAppStartup.cpp
@@ -94,17 +94,18 @@ public:
     mService->mShuttingDown = PR_FALSE;
     mService->mRunning = PR_FALSE;
     return NS_OK;
   }
 };
 
 nsresult RecordStartupDuration();
 nsresult OpenStartupDatabase(mozIStorageConnection **db);
-nsresult EnsureTable(mozIStorageConnection *db, const nsACString &table, const nsACString &schema);
+nsresult EnsureTable(mozIStorageConnection *db, const nsACString &table,
+                     const nsACString &schema);
 nsresult RecordAddonEvent(const PRUnichar *event, nsISupports *details);
 
 //
 // nsAppStartup
 //
 
 nsAppStartup::nsAppStartup() :
   mConsiderQuitStopper(0),
@@ -628,17 +629,18 @@ nsresult OpenStartupDatabase(mozIStorage
   rv = file->Append(NS_LITERAL_STRING("startup.sqlite"));
   NS_ENSURE_SUCCESS(rv, rv);
   nsCOMPtr<mozIStorageService> svc = do_GetService(MOZ_STORAGE_SERVICE_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = svc->OpenDatabase(file, db);
   if (NS_ERROR_FILE_CORRUPTED == rv)
   {
-    svc->BackupDatabaseFile(file, NS_LITERAL_STRING("startup.sqlite.backup"), nsnull, nsnull);
+    svc->BackupDatabaseFile(file, NS_LITERAL_STRING("startup.sqlite.backup"),
+                            nsnull, nsnull);
     rv = svc->OpenDatabase(file, db);
     NS_ENSURE_SUCCESS(rv, rv);
   }
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = EnsureTable(*db,
                    NS_LITERAL_CSTRING("duration"),
                    NS_LITERAL_CSTRING("timestamp INTEGER, launch INTEGER, startup INTEGER, appVersion TEXT, appBuild TEXT, platformVersion TEXT, platformBuild TEXT"));
@@ -646,17 +648,18 @@ nsresult OpenStartupDatabase(mozIStorage
   rv = EnsureTable(*db,
                    NS_LITERAL_CSTRING("events"),
                    NS_LITERAL_CSTRING("timestamp INTEGER, id TEXT, name TEXT, version TEXT, action TEXT"));
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
-nsresult EnsureTable(mozIStorageConnection *db, const nsACString &table, const nsACString &schema)
+nsresult EnsureTable(mozIStorageConnection *db, const nsACString &table,
+                     const nsACString &schema)
 {
   nsresult rv;
   PRBool exists = false;
   rv = db->TableExists(table, &exists);
   NS_ENSURE_SUCCESS(rv, rv);
   if (!exists)
     rv = db->CreateTable(PromiseFlatCString(table).get(),
                          PromiseFlatCString(schema).get());
--- a/toolkit/content/aboutStartup.js
+++ b/toolkit/content/aboutStartup.js
@@ -38,48 +38,53 @@ let runtime = Cc["@mozilla.org/xre/runti
 try {
   displayTimestamp("launched", launched = runtime.launchTimestamp);
 } catch(x) { }
 
 displayTimestamp("started", startup = runtime.startupTimestamp);
 if (launched)
   displayDuration("started", startup - launched);
 
-let ss = Cc["@mozilla.org/browser/sessionstartup;1"].getService(Ci.nsISessionStartup);
+let ss = Cc["@mozilla.org/browser/sessionstartup;1"]
+           .getService(Ci.nsISessionStartup);
 displayTimestamp("restored", restored = ss.restoredTimestamp);
 displayDuration("restored", restored - startup);
 
 ///// Next, load the database
 var file = Components.classes["@mozilla.org/file/directory_service;1"]
                      .getService(Components.interfaces.nsIProperties)
                      .get("ProfD", Components.interfaces.nsIFile);
 file.append("startup.sqlite");
 
 var svc = Components.classes["@mozilla.org/storage/service;1"]
                     .getService(Components.interfaces.mozIStorageService);
 var db = svc.openDatabase(file);
 
 ///// set up the graph options
 var graph, overview;
-var options = { legend: { show: true, position: "ne", margin: 10, labelBoxBorderColor: "transparent" },
+var options = { legend: { show: true, position: "ne", margin: 10,
+                          labelBoxBorderColor: "transparent" },
                 xaxis: { mode: "time" },
                 yaxis: { min: 0, tickFormatter: formatms },
                 selection: { mode: "xy", color: "#00A" },
-                grid: { show: true, borderWidth: 0, markings: [], aboveData: true, tickColor: "white" },
+                grid: { show: true, borderWidth: 0, markings: [],
+                        aboveData: true, tickColor: "white" },
                 series: { lines: { show: true, fill: true },
                           points: { show: true, fill: true },
                         },
                 colors: ["#67A9D8", "#FFC170"],
               };
 var overviewOpts = $.extend(true, {}, options,
                             { legend: { show: false },
                               xaxis: { ticks: [], mode: "time" },
-                              yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 },
+                              yaxis: { ticks: [], min: 0,
+                                       autoscaleMargin: 0.1 },
                               grid: { show: false },
-                              series: { lines: { show: true, fill: true, lineWidth: 1 },
+                              series: { lines: { show: true, fill: true,
+                                                 lineWidth: 1 },
                                         points: { show: false },
                                         shadowSize: 0
                                       },
                             });
 
 var series = [{ label: "Launch Time",
                 data: []
               },
@@ -127,36 +132,39 @@ function go()
     // harmless
   }
 }
 
 go();
 
 function populateMeasurements()
 {
-  var query = db.createStatement("SELECT timestamp, launch, startup, appVersion, appBuild FROM duration");
+  let s = "SELECT timestamp, launch, startup, appVersion, appBuild FROM duration";
+  var query = db.createStatement(s);
   var lastver, lastbuild;
   query.executeAsync({
     handleResult: function(results)
     {
       let hasresults = false;
       let table = document.getElementById("duration-table");
       for (let row = results.getNextRow(); row; row = results.getNextRow())
       {
         hasresults = true;
         let stamp = row.getResultByName("timestamp");
         let version = row.getResultByName("appVersion");
         let build = row.getResultByName("appBuild");
         if (lastver != version)
         {
-          options.grid.markings.push(majorMark(stamp, appVersion(version, build)));
+          options.grid.markings.push(majorMark(stamp, appVersion(version,
+                                                                 build)));
         }
         else
           if (lastbuild != build)
-            options.grid.markings.push(minorMark(stamp, appVersion(version, build)));
+            options.grid.markings.push(minorMark(stamp, appVersion(version,
+                                                                   build)));
 
         lastver = version;
         lastbuild = build;
         let l = row.getResultByName("launch"),
             s = row.getResultByName("startup");
         series[1].data.push(point(stamp, l, version, build));
         series[0].data.push(point(stamp, l + s, version, build));
         table.appendChild(tr(td(formatstamp(stamp)),
@@ -166,22 +174,25 @@ function populateMeasurements()
                              td(version),
                              td(build)));
       }
       if (hasresults)
         $("#duration-table > .empty").hide();
     },
     handleError: function(error)
     {
-      $("#duration-table").appendChild(tr(td("Error: "+ error.message +" ("+ error.result +")")));
+      $("#duration-table").appendChild(tr(td("Error: "+ error.message +" ("+
+                                             error.result +")")));
     },
     handleCompletion: function()
     {
       var table = $("table");
-      var height = $(window).height() - (table.offset().top + table.outerHeight(true)) - 110;
+      var height = $(window).height() - (table.offset().top +
+                                         table.outerHeight(true))
+                                      - 110;
       $("#graph").height(Math.max(350, height));
 
       options.xaxis.min = Date.now() - 604800000; // 7 days in milliseconds
       var max = 0;
       for each (let [stamp, d] in series[0].data)
         if (stamp >= options.xaxis.min && d > max)
           max = d;
       options.yaxis.max = max;
@@ -194,17 +205,18 @@ function populateMeasurements()
       overview = $.plot($("#overview"), series, overviewOpts);
       go();
     },
   });
 }
 
 function populateEvents()
 {
-  var query = db.createStatement("SELECT timestamp, id, name, version, action FROM events");
+  let s = "SELECT timestamp, id, name, version, action FROM events";
+  var query = db.createStatement(s);
   let lastver, lastbuild;
   let hasresults;
 
   query.executeAsync({
     handleResult: function(results)
     {
       Application.getExtensions(function (extensions)
       {
@@ -214,30 +226,34 @@ function populateEvents()
           hasresults = true;
           let stamp = row.getResultByName("timestamp"),
               id = row.getResultByName("id"),
               extension = extensions.get(id),
               name = extension ? extension.name : row.getResultByName("name"),
               version = row.getResultByName("version"),
               action = row.getResultByName("action");
 
-          options.grid.markings.push(extensionMark(stamp, formatExtension(action, name, version)));
+          options.grid.markings.push(extensionMark(stamp,
+                                                   formatExtension(action,
+                                                                   name,
+                                                                   version)));
           table.appendChild(tr(td(formatstamp(stamp)),
                                td(action),
                                td(name),
                                td(id),
                                td(version)));
         }
         if (hasresults)
           $("#events-table > .empty").hide();
       });
     },
     handleError: function(error)
     {
-      $("#events-table").appendChild(tr(td("Error: "+ error.message +" ("+ error.result +")")));
+      $("#events-table").appendChild(tr(td("Error: "+ error.message +" ("+
+                                           error.result +")")));
     },
     handleCompletion: function()
     {
       graph = $.plot($("#graph"), series, options);
       go();
     },
   });
 }
--- a/toolkit/content/aboutStartup.xhtml
+++ b/toolkit/content/aboutStartup.xhtml
@@ -18,49 +18,69 @@
     <script type="application/javascript" src="chrome://jquery/content/jquery.js"/>
     <script type="application/javascript" src="chrome://jquery/content/jquery.flot.js"/>
     <script type="application/javascript" src="chrome://jquery/content/jquery.flot.selection.js"/>
   </head>
 
   <body>
     <h1>&about.startup.title;</h1>
     <table>
-      <tr><th></th><th>&about.startup.timestamp;</th><th>&about.startup.elapsed;</th></tr>
-      <tr><td>&about.startup.app.launched;</td><td id="launched">—</td><td>—</td></tr>
-      <tr><td>&about.startup.app.started;</td><td id="started">—</td><td>—</td></tr>
-      <tr><td>&about.startup.app.ready;</td><td id="restored">—</td><td>—</td></tr>
+      <tr>
+        <th></th>
+        <th>&about.startup.timestamp;</th>
+        <th>&about.startup.elapsed;</th>
+      </tr>
+      <tr>
+        <td>&about.startup.app.launched;</td>
+        <td id="launched">—</td><td>—</td>
+      </tr>
+      <tr>
+        <td>&about.startup.app.started;</td>
+        <td id="started">—</td><td>—</td>
+      </tr>
+      <tr>
+        <td>&about.startup.app.ready;</td>
+        <td id="restored">—</td><td>—</td>
+      </tr>
     </table>
 
     <div id="toggle-container">
-      <a class="toggle" id="showtable" href="#" onclick="showTable()">&about.startup.table;</a>
-      <a class="toggle" id="showgraph" href="#" onclick="showGraph()">&about.startup.graph;</a>
+      <a class="toggle" id="showtable"
+         href="#" onclick="showTable()">&about.startup.table;</a>
+      <a class="toggle" id="showgraph"
+         href="#" onclick="showGraph()">&about.startup.graph;</a>
     </div>
 
     <div id="graphs">
       <div id="graph"/>
       <div id="overview"/>
     </div>
 
     <div id="tables">
       <table id="duration-table">
         <tr>
           <th>&about.startup.timestamp;</th>
           <th>&about.startup.duration.launch;</th>
           <th>&about.startup.duration.startup;</th>
           <th>&about.startup.duration.ready;</th>
           <th colspan="2">&about.startup.version;</th>
         </tr>
-        <tr class="empty"><td colspan="6"><i>&about.startup.noevents;</i></td></tr>
+        <tr class="empty">
+          <td colspan="6"><i>&about.startup.noevents;</i></td>
+        </tr>
       </table>
       <table id="events-table">
         <tr>
           <th>&about.startup.timestamp;</th>
           <th>&about.startup.action;</th>
           <th>&about.startup.extension;</th>
           <th>&about.startup.extensionID;</th>
           <th>&about.startup.version;</th>
         </tr>
-        <tr class="empty"><td colspan="5"><i>&about.startup.noevents;</i></td></tr>
+        <tr class="empty">
+          <td colspan="5"><i>&about.startup.noevents;</i></td>
+        </tr>
       </table>
     </div>
-    <script type="application/javascript;version=1.8" src="chrome://global/content/aboutStartup.js"/>
+    <script type="application/javascript;version=1.8"
+            src="chrome://global/content/aboutStartup.js"/>
   </body>
 </html>