Bug 1075088 - Add telemetry probes for Flash content. r=gfritzsche,mconley

--HG--
extra : rebase_source : 2afac68cc01c045c4d4c85d663e0e76bb4e828ae
This commit is contained in:
Yury Delendik 2014-10-09 16:05:20 -05:00
parent 8ec9f238d9
commit b35ef8b853
2 changed files with 80 additions and 0 deletions

View File

@ -94,6 +94,9 @@ PluginContent.prototype = {
return;
}
if (Services.telemetry.canSend) {
this._finishRecordingFlashPluginTelemetry();
}
this.clearPluginDataCache();
},
@ -378,6 +381,11 @@ PluginContent.prototype = {
break;
}
if (Services.telemetry.canSend && this._getPluginInfo(plugin).mimetype ===
"application/x-shockwave-flash") {
this._recordFlashPluginTelemetry(eventType, plugin);
}
// Show the in-content UI if it's not too big. The crashed plugin handler already did this.
if (eventType != "PluginCrashed") {
let overlay = this.getPluginUI(plugin, "main");
@ -407,6 +415,42 @@ PluginContent.prototype = {
}
},
_recordFlashPluginTelemetry: function (eventType, plugin) {
if (!this.flashPluginStats) {
this.flashPluginStats = {
instancesCount: 0,
plugins: new WeakSet()
};
}
if (!this.flashPluginStats.plugins.has(plugin)) {
// Reporting plugin instance and its dimensions only once.
this.flashPluginStats.plugins.add(plugin);
this.flashPluginStats.instancesCount++;
let pluginRect = plugin.getBoundingClientRect();
Services.telemetry.getHistogramById('FLASH_PLUGIN_WIDTH')
.add(pluginRect.width);
Services.telemetry.getHistogramById('FLASH_PLUGIN_HEIGHT')
.add(pluginRect.height);
Services.telemetry.getHistogramById('FLASH_PLUGIN_AREA')
.add(pluginRect.width * pluginRect.height);
let state = this._getPluginInfo(plugin).fallbackType;
Services.telemetry.getHistogramById('FLASH_PLUGIN_STATES')
.add(state);
}
},
_finishRecordingFlashPluginTelemetry: function () {
if (this.flashPluginStats) {
Services.telemetry.getHistogramById('FLASH_PLUGIN_INSTANCES_ON_PAGE')
.add(this.flashPluginStats.instancesCount);
delete this.flashPluginStats;
}
},
isKnownPlugin: function (objLoadingContent) {
return (objLoadingContent.getContentTypeForMIMEType(objLoadingContent.actualType) ==
Ci.nsIObjectLoadingContent.TYPE_PLUGIN);

View File

@ -2609,6 +2609,42 @@
"kind": "flag",
"description": "A plugin object was successfully invoked as a function"
},
"FLASH_PLUGIN_STATES": {
"expires_in_version": "50",
"kind": "enumerated",
"n_values": 20,
"description": "A flash object's initialization state"
},
"FLASH_PLUGIN_AREA": {
"expires_in_version": "50",
"kind": "exponential",
"low": "256",
"high": "16777216",
"n_buckets": 50,
"description": "Flash object area (width * height)"
},
"FLASH_PLUGIN_WIDTH": {
"expires_in_version": "50",
"kind": "linear",
"low": "1",
"high": "2000",
"n_buckets": 50,
"description": "Flash object width"
},
"FLASH_PLUGIN_HEIGHT": {
"expires_in_version": "50",
"kind": "linear",
"low": "1",
"high": "2000",
"n_buckets": 50,
"description": "Flash object height"
},
"FLASH_PLUGIN_INSTANCES_ON_PAGE": {
"expires_in_version": "50",
"kind": "enumerated",
"n_values": 30,
"description": "Flash object instances count on page"
},
"MOZ_SQLITE_OPEN_MS": {
"expires_in_version": "default",
"kind": "exponential",