mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-08-15 08:53:07 +09:00
Issue #21 - Remove calls to Services.telemetry and nsITelemetry
These calls would cause breakage without the supporting plumbing.
This commit is contained in:
parent
d356440fa3
commit
d562709920
8 changed files with 3 additions and 137 deletions
|
|
@ -13,18 +13,12 @@ const { makeInfallible, immutableUpdate } = require("devtools/shared/DevToolsUti
|
|||
const { labelDisplays, treeMapDisplays, censusDisplays } = require("./constants");
|
||||
|
||||
exports.countTakeSnapshot = makeInfallible(function () {
|
||||
const histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_TAKE_SNAPSHOT_COUNT");
|
||||
histogram.add(1);
|
||||
}, "devtools/client/memory/telemetry#countTakeSnapshot");
|
||||
|
||||
exports.countImportSnapshot = makeInfallible(function () {
|
||||
const histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_IMPORT_SNAPSHOT_COUNT");
|
||||
histogram.add(1);
|
||||
}, "devtools/client/memory/telemetry#countImportSnapshot");
|
||||
|
||||
exports.countExportSnapshot = makeInfallible(function () {
|
||||
const histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_EXPORT_SNAPSHOT_COUNT");
|
||||
histogram.add(1);
|
||||
}, "devtools/client/memory/telemetry#countExportSnapshot");
|
||||
|
||||
const COARSE_TYPE = "Coarse Type";
|
||||
|
|
@ -43,25 +37,6 @@ const CUSTOM = "Custom";
|
|||
* The display used with the census.
|
||||
*/
|
||||
exports.countCensus = makeInfallible(function ({ filter, diffing, display }) {
|
||||
let histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_INVERTED_CENSUS");
|
||||
histogram.add(!!display.inverted);
|
||||
|
||||
histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_FILTER_CENSUS");
|
||||
histogram.add(!!filter);
|
||||
|
||||
histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_DIFF_CENSUS");
|
||||
histogram.add(!!diffing);
|
||||
|
||||
histogram = telemetry.getKeyedHistogramById("DEVTOOLS_MEMORY_BREAKDOWN_CENSUS_COUNT");
|
||||
if (display === censusDisplays.coarseType) {
|
||||
histogram.add(COARSE_TYPE);
|
||||
} else if (display === censusDisplays.allocationStack) {
|
||||
histogram.add(ALLOCATION_STACK);
|
||||
} else if (display === censusDisplays.invertedAllocationStack) {
|
||||
histogram.add(INVERTED_ALLOCATION_STACK);
|
||||
} else {
|
||||
histogram.add(CUSTOM);
|
||||
}
|
||||
}, "devtools/client/memory/telemetry#countCensus");
|
||||
|
||||
/**
|
||||
|
|
@ -77,15 +52,4 @@ exports.countDiff = makeInfallible(function (opts) {
|
|||
* The display used to label nodes in the dominator tree.
|
||||
*/
|
||||
exports.countDominatorTree = makeInfallible(function ({ display }) {
|
||||
let histogram = telemetry.getHistogramById("DEVTOOLS_MEMORY_DOMINATOR_TREE_COUNT");
|
||||
histogram.add(1);
|
||||
|
||||
histogram = telemetry.getKeyedHistogramById("DEVTOOLS_MEMORY_BREAKDOWN_DOMINATOR_TREE_COUNT");
|
||||
if (display === labelDisplays.coarseType) {
|
||||
histogram.add(COARSE_TYPE);
|
||||
} else if (display === labelDisplays.allocationStack) {
|
||||
histogram.add(ALLOCATION_STACK);
|
||||
} else {
|
||||
histogram.add(CUSTOM);
|
||||
}
|
||||
}, "devtools/client/memory/telemetry#countDominatorTree");
|
||||
|
|
|
|||
|
|
@ -502,7 +502,7 @@ const Services = {
|
|||
return window.navigator.appVersion;
|
||||
},
|
||||
|
||||
// This is only used by telemetry, which is disabled for the
|
||||
// This was only used by telemetry, which is disabled for the
|
||||
// content case. So, being totally wrong is ok.
|
||||
get is64Bit() {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -266,15 +266,7 @@ Telemetry.prototype = {
|
|||
* Value to store.
|
||||
*/
|
||||
log: function (histogramId, value) {
|
||||
if (histogramId) {
|
||||
try {
|
||||
let histogram = Services.telemetry.getHistogramById(histogramId);
|
||||
histogram.add(value);
|
||||
} catch (e) {
|
||||
dump("Warning: An attempt was made to write to the " + histogramId +
|
||||
" histogram, which is not defined in Histograms.json\n");
|
||||
}
|
||||
}
|
||||
/* STUB */
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
@ -288,15 +280,7 @@ Telemetry.prototype = {
|
|||
* Value to store.
|
||||
*/
|
||||
logKeyed: function (histogramId, key, value) {
|
||||
if (histogramId) {
|
||||
try {
|
||||
let histogram = Services.telemetry.getKeyedHistogramById(histogramId);
|
||||
histogram.add(key, value);
|
||||
} catch (e) {
|
||||
dump("Warning: An attempt was made to write to the " + histogramId +
|
||||
" histogram, which is not defined in Histograms.json\n");
|
||||
}
|
||||
}
|
||||
/* STUB */
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ var DoPreloadPostfork = function(aCallback) {
|
|||
|
||||
Cc["@mozilla.org/appshell/appShellService;1"].getService(Ci["nsIAppShellService"]);
|
||||
Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci["nsIWindowMediator"]);
|
||||
Cc["@mozilla.org/base/telemetry;1"].getService(Ci["nsITelemetry"]);
|
||||
Cc["@mozilla.org/categorymanager;1"].getService(Ci["nsICategoryManager"]);
|
||||
Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci["nsIMessageSender"]);
|
||||
Cc["@mozilla.org/consoleservice;1"].getService(Ci["nsIConsoleService"]);
|
||||
|
|
|
|||
|
|
@ -1405,22 +1405,6 @@ PeerConnectionObserver.prototype = {
|
|||
|
||||
handleIceConnectionStateChange: function(iceConnectionState) {
|
||||
let pc = this._dompc;
|
||||
if (pc.iceConnectionState === 'new') {
|
||||
var checking_histogram = Services.telemetry.getHistogramById("WEBRTC_ICE_CHECKING_RATE");
|
||||
if (iceConnectionState === 'checking') {
|
||||
checking_histogram.add(true);
|
||||
} else if (iceConnectionState === 'failed') {
|
||||
checking_histogram.add(false);
|
||||
}
|
||||
} else if (pc.iceConnectionState === 'checking') {
|
||||
var success_histogram = Services.telemetry.getHistogramById("WEBRTC_ICE_SUCCESS_RATE");
|
||||
if (iceConnectionState === 'completed' ||
|
||||
iceConnectionState === 'connected') {
|
||||
success_histogram.add(true);
|
||||
} else if (iceConnectionState === 'failed') {
|
||||
success_histogram.add(false);
|
||||
}
|
||||
}
|
||||
|
||||
if (iceConnectionState === 'failed') {
|
||||
pc.logError("ICE failed, see about:webrtc for more details");
|
||||
|
|
|
|||
|
|
@ -213,7 +213,6 @@ var ClickEventHandler = {
|
|||
}
|
||||
|
||||
const kAutoscroll = 15; // defined in mozilla/layers/ScrollInputMethods.h
|
||||
Services.telemetry.getHistogramById("SCROLL_INPUT_METHODS").add(kAutoscroll);
|
||||
|
||||
this._scrollable.scrollBy({
|
||||
left: actualScrollX,
|
||||
|
|
@ -681,23 +680,8 @@ var Printing = {
|
|||
let print = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebBrowserPrint);
|
||||
|
||||
if (print.doingPrintPreview) {
|
||||
this.logKeyedTelemetry("PRINT_DIALOG_OPENED_COUNT", "FROM_PREVIEW");
|
||||
} else {
|
||||
this.logKeyedTelemetry("PRINT_DIALOG_OPENED_COUNT", "FROM_PAGE");
|
||||
}
|
||||
|
||||
print.print(printSettings, null);
|
||||
|
||||
if (print.doingPrintPreview) {
|
||||
if (simplifiedMode) {
|
||||
this.logKeyedTelemetry("PRINT_COUNT", "SIMPLIFIED");
|
||||
} else {
|
||||
this.logKeyedTelemetry("PRINT_COUNT", "WITH_PREVIEW");
|
||||
}
|
||||
} else {
|
||||
this.logKeyedTelemetry("PRINT_COUNT", "WITHOUT_PREVIEW");
|
||||
}
|
||||
} catch (e) {
|
||||
// Pressing cancel is expressed as an NS_ERROR_ABORT return value,
|
||||
// causing an exception to be thrown which we catch here.
|
||||
|
|
@ -722,11 +706,6 @@ var Printing = {
|
|||
}
|
||||
},
|
||||
|
||||
logKeyedTelemetry(id, key) {
|
||||
let histogram = Services.telemetry.getKeyedHistogramById(id);
|
||||
histogram.add(key);
|
||||
},
|
||||
|
||||
updatePageCount() {
|
||||
let numPages = docShell.printPreview.printPreviewNumPages;
|
||||
sendAsyncMessage("Printing:Preview:UpdatePageCount", {
|
||||
|
|
|
|||
|
|
@ -49,9 +49,6 @@ const HISTORY_RESULTS_LIMIT = 100;
|
|||
// The maximum number of links Links.getLinks will return.
|
||||
const LINKS_GET_LINKS_LIMIT = 100;
|
||||
|
||||
// The gather telemetry topic.
|
||||
const TOPIC_GATHER_TELEMETRY = "gather-telemetry";
|
||||
|
||||
/**
|
||||
* Calculate the MD5 hash for a string.
|
||||
* @param aValue
|
||||
|
|
@ -1248,45 +1245,6 @@ var Links = {
|
|||
|
||||
Links.compareLinks = Links.compareLinks.bind(Links);
|
||||
|
||||
/**
|
||||
* Singleton used to collect telemetry data.
|
||||
*
|
||||
*/
|
||||
var Telemetry = {
|
||||
/**
|
||||
* Initializes object.
|
||||
*/
|
||||
init: function Telemetry_init() {
|
||||
Services.obs.addObserver(this, TOPIC_GATHER_TELEMETRY, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Collects data.
|
||||
*/
|
||||
_collect: function Telemetry_collect() {
|
||||
let probes = [
|
||||
{ histogram: "NEWTAB_PAGE_ENABLED",
|
||||
value: AllPages.enabled },
|
||||
{ histogram: "NEWTAB_PAGE_PINNED_SITES_COUNT",
|
||||
value: PinnedLinks.links.length },
|
||||
{ histogram: "NEWTAB_PAGE_BLOCKED_SITES_COUNT",
|
||||
value: Object.keys(BlockedLinks.links).length }
|
||||
];
|
||||
|
||||
probes.forEach(function Telemetry_collect_forEach(aProbe) {
|
||||
Services.telemetry.getHistogramById(aProbe.histogram)
|
||||
.add(aProbe.value);
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* Listens for gather telemetry topic.
|
||||
*/
|
||||
observe: function Telemetry_observe(aSubject, aTopic, aData) {
|
||||
this._collect();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Singleton that checks if a given link should be displayed on about:newtab
|
||||
* or if we should rather not do it for security reasons. URIs that inherit
|
||||
|
|
@ -1387,7 +1345,6 @@ this.NewTabUtils = {
|
|||
if (!this._initialized) {
|
||||
this._initialized = true;
|
||||
ExpirationFilter.init();
|
||||
Telemetry.init();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -76,7 +76,6 @@ var initTable = [
|
|||
["storage", "@mozilla.org/storage/service;1", "mozIStorageService"],
|
||||
["domStorageManager", "@mozilla.org/dom/localStorage-manager;1", "nsIDOMStorageManager"],
|
||||
["strings", "@mozilla.org/intl/stringbundle;1", "nsIStringBundleService"],
|
||||
["telemetry", "@mozilla.org/base/telemetry;1", "nsITelemetry"],
|
||||
["tm", "@mozilla.org/thread-manager;1", "nsIThreadManager"],
|
||||
["urlFormatter", "@mozilla.org/toolkit/URLFormatterService;1", "nsIURLFormatter"],
|
||||
["vc", "@mozilla.org/xpcom/version-comparator;1", "nsIVersionComparator"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue