Bug 924651 - Log crashes as a telemetry completion reason in BackgroundPageThumbs. r=markh,froydnj

This commit is contained in:
Drew Willcoxon 2013-10-09 10:13:01 -07:00
parent 860fcdc1c3
commit 4c3224ce87
2 changed files with 11 additions and 9 deletions

View File

@ -4114,9 +4114,9 @@
"extended_statistics_ok": true,
"description": "BACKGROUND THUMBNAILS: Time the capture took once it started and successfully completed (ms)"
},
"FX_THUMBNAILS_BG_CAPTURE_DONE_REASON": {
"FX_THUMBNAILS_BG_CAPTURE_DONE_REASON_2": {
"kind": "enumerated",
"n_values": 4,
"n_values": 10,
"description": "BACKGROUND THUMBNAILS: Reason the capture completed (see TEL_CAPTURE_DONE_* constants in BackgroundPageThumbs.jsm)"
},
"FX_THUMBNAILS_BG_CAPTURE_PAGE_LOAD_TIME_MS": {

View File

@ -19,10 +19,11 @@ const FRAME_SCRIPT_URL = "chrome://global/content/backgroundPageThumbsContent.js
const TELEMETRY_HISTOGRAM_ID_PREFIX = "FX_THUMBNAILS_BG_";
// possible FX_THUMBNAILS_BG_CAPTURE_DONE_REASON telemetry values
// possible FX_THUMBNAILS_BG_CAPTURE_DONE_REASON_2 telemetry values
const TEL_CAPTURE_DONE_OK = 0;
const TEL_CAPTURE_DONE_TIMEOUT = 1;
// 2 and 3 were used when we had special handling for private-browsing.
const TEL_CAPTURE_DONE_CRASHED = 4;
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const HTML_NS = "http://www.w3.org/1999/xhtml";
@ -201,7 +202,7 @@ const BackgroundPageThumbs = {
// "resetting" the capture requires more work - so for now, we just
// discard it.
if (curCapture && curCapture.pending) {
curCapture._done(null);
curCapture._done(null, TEL_CAPTURE_DONE_CRASHED);
// _done automatically continues queue processing.
}
// else: we must have been idle and not currently doing a capture (eg,
@ -336,26 +337,27 @@ Capture.prototype = {
// Called when the didCapture message is received.
receiveMessage: function (msg) {
tel("CAPTURE_DONE_REASON", TEL_CAPTURE_DONE_OK);
tel("CAPTURE_SERVICE_TIME_MS", new Date() - this.startDate);
// A different timed-out capture may have finally successfully completed, so
// discard messages that aren't meant for this capture.
if (msg.json.id == this.id)
this._done(msg.json);
this._done(msg.json, TEL_CAPTURE_DONE_OK);
},
// Called when the timeout timer fires.
notify: function () {
tel("CAPTURE_DONE_REASON", TEL_CAPTURE_DONE_TIMEOUT);
this._done(null);
this._done(null, TEL_CAPTURE_DONE_TIMEOUT);
},
_done: function (data) {
_done: function (data, reason) {
// Note that _done will be called only once, by either receiveMessage or
// notify, since it calls destroy, which cancels the timeout timer and
// removes the didCapture message listener.
if (typeof(reason) != "number")
throw new Error("A done reason must be given.");
tel("CAPTURE_DONE_REASON_2", reason);
if (data && data.telemetry) {
// Telemetry is currently disabled in the content process (bug 680508).
for (let id in data.telemetry) {