Add monitor information to the telemetry environment. (bug 1175005 part 5, r=gfritzsche)

--HG--
extra : rebase_source : bbef42732fea99d19ab0fb46b76f8fb358d09229
This commit is contained in:
David Anderson 2015-06-17 23:12:19 -07:00
parent 4a507c66a0
commit 13754852de
3 changed files with 36 additions and 0 deletions

View File

@ -1127,8 +1127,18 @@ EnvironmentCache.prototype = {
// again as part of bug 1154500.
//DWriteVersion: getGfxField("DWriteVersion", null),
adapters: [],
monitors: [],
};
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
let gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
try {
gfxData.monitors = gfxInfo.getMonitors();
} catch (e) {
this._log.error("nsIGfxInfo.getMonitors() caught error", e);
}
#endif
// GfxInfo does not yet expose a way to iterate through all the adapters.
gfxData.adapters.push(getGfxAdapter(""));
gfxData.adapters[0].GPUActive = true;

View File

@ -133,6 +133,18 @@ Structure::
},
...
],
// Note: currently only added on Desktop. On Linux, only a single
// monitor is returned representing the entire virtual screen.
monitors: [
{
screenWidth: <number>, // screen width in pixels
screenHeight: <number>, // screen height in pixels
refreshRate: <number>, // refresh rate in hertz (present on Windows only)
pseudoDisplay: <bool>, // networked screen (present on Windows only)
scale: <number>, // backing scale factor (present on Mac only)
},
...
],
},
},
addons: {

View File

@ -416,6 +416,20 @@ function checkSystemSection(data) {
Assert.equal(typeof gfxData.adapters[0].GPUActive, "boolean");
Assert.ok(gfxData.adapters[0].GPUActive, "The first GFX adapter must be active.");
Assert.ok(Array.isArray(gfxData.monitors));
if (gIsWindows || gIsMac) {
Assert.ok(gfxData.monitors.length >= 1, "There is at least one monitor.");
Assert.equal(typeof gfxData.monitors[0].screenWidth, "number");
Assert.equal(typeof gfxData.monitors[0].screenHeight, "number");
if (gIsWindows) {
Assert.equal(typeof gfxData.monitors[0].refreshRate, "number");
Assert.equal(typeof gfxData.monitors[0].pseudoDisplay, "boolean");
}
if (gIsMac) {
Assert.equal(typeof gfxData.monitors[0].scale, "number");
}
}
try {
// If we've not got nsIGfxInfoDebug, then this will throw and stop us doing
// this test.