From 9defcbd8777d06c1b498f94d102fc25db3d6bb40 Mon Sep 17 00:00:00 2001 From: Justin Dolske Date: Fri, 27 Jun 2014 11:20:02 -0700 Subject: [PATCH] Bug 1023508 - Add telemetry for HiDPI usage. r=felipe --- browser/components/nsBrowserGlue.js | 18 +++++++++++++++ toolkit/components/telemetry/Histograms.json | 24 ++++++++++++++++++++ 2 files changed, 42 insertions(+) diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index da9fcad6ab8f..574a6933c164 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -630,6 +630,22 @@ BrowserGlue.prototype = { nb.PRIORITY_INFO_LOW, buttons); }, + _firstWindowTelemetry: function(aWindow) { +#ifdef XP_WIN + let SCALING_PROBE_NAME = "DISPLAY_SCALING_MSWIN"; +#elifdef XP_MACOSX + let SCALING_PROBE_NAME = "DISPLAY_SCALING_OSX"; +#elifdef XP_LINUX + let SCALING_PROBE_NAME = "DISPLAY_SCALING_LINUX"; +#else + let SCALING_PROBE_NAME = ""; +#endif + if (SCALING_PROBE_NAME) { + let scaling = aWindow.devicePixelRatio * 100; + Services.telemetry.getHistogramById(SCALING_PROBE_NAME).add(scaling); + } + }, + // the first browser window has finished initializing _onFirstWindowLoaded: function BG__onFirstWindowLoaded(aWindow) { #ifdef XP_WIN @@ -658,6 +674,8 @@ BrowserGlue.prototype = { } this._checkForOldBuildUpdates(); + + this._firstWindowTelemetry(aWindow); }, /** diff --git a/toolkit/components/telemetry/Histograms.json b/toolkit/components/telemetry/Histograms.json index 1297ffce4aa4..2ab5b57efe7b 100644 --- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -6446,5 +6446,29 @@ "expires_in_version": "never", "kind": "flag", "description": "If a master-password is enabled for this profile" + }, + "DISPLAY_SCALING_OSX" : { + "expires_in_version": "never", + "kind": "linear", + "high": "500", + "n_buckets": "100", + "description": "Scaling percentage for the display where the first window is opened (OS X only)", + "cpp_guard": "XP_MACOSX" + }, + "DISPLAY_SCALING_MSWIN" : { + "expires_in_version": "never", + "kind": "linear", + "high": "500", + "n_buckets": "100", + "description": "Scaling percentage for the display where the first window is opened (MS Windows only)", + "cpp_guard": "XP_WIN" + }, + "DISPLAY_SCALING_LINUX" : { + "expires_in_version": "never", + "kind": "linear", + "high": "500", + "n_buckets": "100", + "description": "Scaling percentage for the display where the first window is opened (Linux only)", + "cpp_guard": "XP_LINUX" } }