Skip to content

Commit

Permalink
Bug 710431, add telemetry for new browser window command, r=dao
Browse files Browse the repository at this point in the history
  • Loading branch information
EnnDeakin2 committed Mar 9, 2012
1 parent a72e26e commit 6bd71c1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
17 changes: 17 additions & 0 deletions browser/base/content/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,9 @@ __defineSetter__("PluralForm", function (val) {
return this.PluralForm = val;
});

XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStopwatch",
"resource:///modules/TelemetryStopwatch.jsm");

#ifdef MOZ_SERVICES_SYNC
XPCOMUtils.defineLazyGetter(this, "Weave", function() {
let tmp = {};
Expand Down Expand Up @@ -3641,6 +3644,20 @@ function toOpenWindowByType(inType, uri, features)

function OpenBrowserWindow()
{
var telemetryObj = {};
TelemetryStopwatch.start("FX_NEW_WINDOW_MS", telemetryObj);

function newDocumentShown(doc, topic, data) {
if (topic == "document-shown" &&
doc != document &&
doc.location == "chrome://browser/content/browser.xul" &&
doc.defaultView == win) {
Services.obs.removeObserver(newDocumentShown, "document-shown");
TelemetryStopwatch.finish("FX_NEW_WINDOW_MS", telemetryObj);
}
};
Services.obs.addObserver(newDocumentShown, "document-shown", false);

var charsetArg = new String();
var handler = Components.classes["@mozilla.org/browser/clh;1"]
.getService(Components.interfaces.nsIBrowserHandler);
Expand Down
1 change: 1 addition & 0 deletions toolkit/components/telemetry/TelemetryHistograms.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ HISTOGRAM_BOOLEAN(FX_KEYWORD_URL_USERSET, "Firefox: keyword.URL has a user-set v
HISTOGRAM(FX_IDENTITY_POPUP_OPEN_MS, 1, 1000, 10, EXPONENTIAL, "Firefox: Time taken by the identity popup to open in milliseconds")
HISTOGRAM(FX_APP_MENU_OPEN_MS, 1, 1000, 10, EXPONENTIAL, "Firefox: Time taken by the app-menu opening in milliseconds")
HISTOGRAM(FX_BOOKMARKS_TOOLBAR_INIT_MS, 50, 5000, 10, EXPONENTIAL, "Firefox: Time to initialize the bookmarks toolbar view (ms)")
HISTOGRAM(FX_NEW_WINDOW_MS, 1, 10000, 20, EXPONENTIAL, "Firefox: Time taken to open a new browser window (ms)")

/**
* Thumbnail Service telemetry.
Expand Down

0 comments on commit 6bd71c1

Please sign in to comment.