Skip to content

Commit 8c8145e

Browse files
wolfbeastroytam1
wolfbeast
authored andcommitted
Remove all C++ Telemetry Accumulation calls.
This creates a number of stubs and leaves some surrounding code that may be irrelevant (eg. recorded time stamps, status variables). Stub resolution/removal should be a follow-up to this.
1 parent ac3468d commit 8c8145e

File tree

186 files changed

+48
-2957
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

186 files changed

+48
-2957
lines changed

accessible/base/Statistics.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,22 @@ namespace a11y {
1414
namespace statistics {
1515

1616
inline void A11yInitialized()
17-
{ Telemetry::Accumulate(Telemetry::A11Y_INSTANTIATED_FLAG, true); }
17+
{ /* STUB */ }
1818

1919
inline void A11yConsumers(uint32_t aConsumer)
20-
{ Telemetry::Accumulate(Telemetry::A11Y_CONSUMERS, aConsumer); }
20+
{ /* STUB */ }
2121

2222
/**
2323
* Report that ISimpleDOM* has been used.
2424
*/
2525
inline void ISimpleDOMUsed()
26-
{ Telemetry::Accumulate(Telemetry::A11Y_ISIMPLEDOM_USAGE_FLAG, true); }
26+
{ /* STUB */ }
2727

2828
/**
2929
* Report that IAccessibleTable has been used.
3030
*/
3131
inline void IAccessibleTableUsed()
32-
{ Telemetry::Accumulate(Telemetry::A11Y_IATABLE_USAGE_FLAG, true); }
32+
{ /* STUB */ }
3333

3434
} // namespace statistics
3535
} // namespace a11y

devtools/shared/heapsnapshot/HeapSnapshot.cpp

-12
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "mozilla/dom/ContentChild.h"
2929
#include "mozilla/dom/HeapSnapshotBinding.h"
3030
#include "mozilla/RangedPtr.h"
31-
#include "mozilla/Telemetry.h"
3231
#include "mozilla/Unused.h"
3332

3433
#include "jsapi.h"
@@ -1610,13 +1609,6 @@ ThreadSafeChromeUtils::SaveHeapSnapshot(GlobalObject& global,
16101609
return;
16111610
}
16121611
}
1613-
1614-
Telemetry::AccumulateTimeDelta(Telemetry::DEVTOOLS_SAVE_HEAP_SNAPSHOT_MS,
1615-
start);
1616-
Telemetry::Accumulate(Telemetry::DEVTOOLS_HEAP_SNAPSHOT_NODE_COUNT,
1617-
nodeCount);
1618-
Telemetry::Accumulate(Telemetry::DEVTOOLS_HEAP_SNAPSHOT_EDGE_COUNT,
1619-
edgeCount);
16201612
}
16211613

16221614
/* static */ already_AddRefed<HeapSnapshot>
@@ -1641,10 +1633,6 @@ ThreadSafeChromeUtils::ReadHeapSnapshot(GlobalObject& global,
16411633
global.Context(), global, reinterpret_cast<const uint8_t*>(mm.address()),
16421634
mm.size(), rv);
16431635

1644-
if (!rv.Failed())
1645-
Telemetry::AccumulateTimeDelta(Telemetry::DEVTOOLS_READ_HEAP_SNAPSHOT_MS,
1646-
start);
1647-
16481636
return snapshot.forget();
16491637
}
16501638

docshell/base/nsDocShell.cpp

+1-75
Original file line numberDiff line numberDiff line change
@@ -1972,71 +1972,7 @@ nsDocShell::GetCharset(nsACString& aCharset)
19721972
NS_IMETHODIMP
19731973
nsDocShell::GatherCharsetMenuTelemetry()
19741974
{
1975-
nsCOMPtr<nsIContentViewer> viewer;
1976-
GetContentViewer(getter_AddRefs(viewer));
1977-
if (!viewer) {
1978-
return NS_OK;
1979-
}
1980-
1981-
nsIDocument* doc = viewer->GetDocument();
1982-
if (!doc || doc->WillIgnoreCharsetOverride()) {
1983-
return NS_OK;
1984-
}
1985-
1986-
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_USED, true);
1987-
1988-
bool isFileURL = false;
1989-
nsIURI* url = doc->GetOriginalURI();
1990-
if (url) {
1991-
url->SchemeIs("file", &isFileURL);
1992-
}
1993-
1994-
int32_t charsetSource = doc->GetDocumentCharacterSetSource();
1995-
switch (charsetSource) {
1996-
case kCharsetFromTopLevelDomain:
1997-
// Unlabeled doc on a domain that we map to a fallback encoding
1998-
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 7);
1999-
break;
2000-
case kCharsetFromFallback:
2001-
case kCharsetFromDocTypeDefault:
2002-
case kCharsetFromCache:
2003-
case kCharsetFromParentFrame:
2004-
case kCharsetFromHintPrevDoc:
2005-
// Changing charset on an unlabeled doc.
2006-
if (isFileURL) {
2007-
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 0);
2008-
} else {
2009-
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 1);
2010-
}
2011-
break;
2012-
case kCharsetFromAutoDetection:
2013-
// Changing charset on unlabeled doc where chardet fired
2014-
if (isFileURL) {
2015-
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 2);
2016-
} else {
2017-
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 3);
2018-
}
2019-
break;
2020-
case kCharsetFromMetaPrescan:
2021-
case kCharsetFromMetaTag:
2022-
case kCharsetFromChannel:
2023-
// Changing charset on a doc that had a charset label.
2024-
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 4);
2025-
break;
2026-
case kCharsetFromParentForced:
2027-
case kCharsetFromUserForced:
2028-
// Changing charset on a document that already had an override.
2029-
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 5);
2030-
break;
2031-
case kCharsetFromIrreversibleAutoDetection:
2032-
case kCharsetFromOtherComponent:
2033-
case kCharsetFromByteOrderMark:
2034-
case kCharsetUninitialized:
2035-
default:
2036-
// Bug. This isn't supposed to happen.
2037-
Telemetry::Accumulate(Telemetry::CHARSET_OVERRIDE_SITUATION, 6);
2038-
break;
2039-
}
1975+
/* STUB */
20401976
return NS_OK;
20411977
}
20421978

@@ -5062,10 +4998,6 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
50624998
errorPage.Assign(alternateErrorPage);
50634999
}
50645000

5065-
if (!IsFrame() && errorPage.EqualsIgnoreCase("certerror")) {
5066-
Telemetry::Accumulate(mozilla::Telemetry::SECURITY_UI, bucketId);
5067-
}
5068-
50695001
} else {
50705002
error.AssignLiteral("nssFailure2");
50715003
}
@@ -5105,10 +5037,6 @@ nsDocShell::DisplayLoadError(nsresult aError, nsIURI* aURI,
51055037
: nsISecurityUITelemetry::WARNING_UNWANTED_PAGE_TOP;
51065038
}
51075039

5108-
if (sendTelemetry && errorPage.EqualsIgnoreCase("blocked")) {
5109-
Telemetry::Accumulate(Telemetry::SECURITY_UI, bucketId);
5110-
}
5111-
51125040
cssClass.AssignLiteral("blacklist");
51135041
} else if (NS_ERROR_CONTENT_CRASHED == aError) {
51145042
errorPage.AssignLiteral("tabcrashed");
@@ -7622,8 +7550,6 @@ nsDocShell::EndPageLoad(nsIWebProgress* aProgress,
76227550
TimeStamp channelCreationTime;
76237551
rv = timingChannel->GetChannelCreation(&channelCreationTime);
76247552
if (NS_SUCCEEDED(rv) && !channelCreationTime.IsNull()) {
7625-
Telemetry::AccumulateTimeDelta(Telemetry::TOTAL_CONTENT_PAGE_LOAD_TIME,
7626-
channelCreationTime);
76277553
nsCOMPtr<nsPILoadGroupInternal> internalLoadGroup =
76287554
do_QueryInterface(mLoadGroup);
76297555
if (internalLoadGroup) {

dom/base/nsDOMClassInfo.cpp

-4
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
#include "nsContentUtils.h"
5050
#include "nsIDOMGlobalPropertyInitializer.h"
5151
#include "mozilla/Attributes.h"
52-
#include "mozilla/Telemetry.h"
5352

5453
// Window scriptable helper includes
5554
#include "nsScriptNameSpaceManager.h"
@@ -1903,9 +1902,6 @@ LookupComponentsShim(JSContext *cx, JS::Handle<JSObject*> global,
19031902
nsPIDOMWindowInner *win,
19041903
JS::MutableHandle<JS::PropertyDescriptor> desc)
19051904
{
1906-
// Keep track of how often this happens.
1907-
Telemetry::Accumulate(Telemetry::COMPONENTS_SHIM_ACCESSED_BY_CONTENT, true);
1908-
19091905
// Warn once.
19101906
nsCOMPtr<nsIDocument> doc = win->GetExtantDoc();
19111907
if (doc) {

dom/base/nsDOMNavigationTiming.cpp

-7
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include "nsPrintfCString.h"
1616
#include "mozilla/dom/PerformanceNavigation.h"
1717
#include "mozilla/TimeStamp.h"
18-
#include "mozilla/Telemetry.h"
1918

2019
using namespace mozilla;
2120

@@ -203,12 +202,6 @@ nsDOMNavigationTiming::NotifyNonBlankPaintForRootContentDocument()
203202
mDocShellHasBeenActiveSinceNavigationStart ? "foreground tab" : "this tab was inactive some of the time between navigation start and first non-blank paint");
204203
PROFILER_MARKER(marker.get());
205204
}
206-
207-
if (mDocShellHasBeenActiveSinceNavigationStart) {
208-
Telemetry::AccumulateTimeDelta(Telemetry::TIME_TO_NON_BLANK_PAINT_MS,
209-
mNavigationStart,
210-
mNonBlankPaint);
211-
}
212205
}
213206

214207
void

dom/base/nsDocument.cpp

+1-96
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
#include "plstr.h"
2626
#include "mozilla/Sprintf.h"
2727

28-
#include "mozilla/Telemetry.h"
2928
#include "nsIInterfaceRequestor.h"
3029
#include "nsIInterfaceRequestorUtils.h"
3130
#include "nsILoadContext.h"
@@ -12370,101 +12369,7 @@ MightBeAboutOrChromeScheme(nsIURI* aURI)
1237012369
void
1237112370
nsDocument::ReportUseCounters()
1237212371
{
12373-
static const bool sDebugUseCounters = false;
12374-
if (mReportedUseCounters) {
12375-
return;
12376-
}
12377-
12378-
mReportedUseCounters = true;
12379-
12380-
if (Telemetry::HistogramUseCounterCount > 0 &&
12381-
(IsContentDocument() || IsResourceDoc())) {
12382-
nsCOMPtr<nsIURI> uri;
12383-
NodePrincipal()->GetURI(getter_AddRefs(uri));
12384-
if (!uri || MightBeAboutOrChromeScheme(uri)) {
12385-
return;
12386-
}
12387-
12388-
if (sDebugUseCounters) {
12389-
nsCString spec = uri->GetSpecOrDefault();
12390-
12391-
// URIs can be rather long for data documents, so truncate them to
12392-
// some reasonable length.
12393-
spec.Truncate(std::min(128U, spec.Length()));
12394-
printf("-- Use counters for %s --\n", spec.get());
12395-
}
12396-
12397-
// We keep separate counts for individual documents and top-level
12398-
// pages to more accurately track how many web pages might break if
12399-
// certain features were removed. Consider the case of a single
12400-
// HTML document with several SVG images and/or iframes with
12401-
// sub-documents of their own. If we maintained a single set of use
12402-
// counters and all the sub-documents use a particular feature, then
12403-
// telemetry would indicate that we would be breaking N documents if
12404-
// that feature were removed. Whereas with a document/top-level
12405-
// page split, we can see that N documents would be affected, but
12406-
// only a single web page would be affected.
12407-
12408-
// The difference between the values of these two histograms and the
12409-
// related use counters below tell us how many pages did *not* use
12410-
// the feature in question. For instance, if we see that a given
12411-
// session has destroyed 30 content documents, but a particular use
12412-
// counter shows only a count of 5, we can infer that the use
12413-
// counter was *not* used in 25 of those 30 documents.
12414-
//
12415-
// We do things this way, rather than accumulating a boolean flag
12416-
// for each use counter, to avoid sending histograms for features
12417-
// that don't get widely used. Doing things in this fashion means
12418-
// smaller telemetry payloads and faster processing on the server
12419-
// side.
12420-
Telemetry::Accumulate(Telemetry::CONTENT_DOCUMENTS_DESTROYED, 1);
12421-
if (IsTopLevelContentDocument()) {
12422-
Telemetry::Accumulate(Telemetry::TOP_LEVEL_CONTENT_DOCUMENTS_DESTROYED, 1);
12423-
}
12424-
12425-
for (int32_t c = 0;
12426-
c < eUseCounter_Count; ++c) {
12427-
UseCounter uc = static_cast<UseCounter>(c);
12428-
12429-
Telemetry::ID id =
12430-
static_cast<Telemetry::ID>(Telemetry::HistogramFirstUseCounter + uc * 2);
12431-
bool value = GetUseCounter(uc);
12432-
12433-
if (value) {
12434-
if (sDebugUseCounters) {
12435-
const char* name = Telemetry::GetHistogramName(id);
12436-
if (name) {
12437-
printf(" %s", name);
12438-
} else {
12439-
printf(" #%d", id);
12440-
}
12441-
printf(": %d\n", value);
12442-
}
12443-
12444-
Telemetry::Accumulate(id, 1);
12445-
}
12446-
12447-
if (IsTopLevelContentDocument()) {
12448-
id = static_cast<Telemetry::ID>(Telemetry::HistogramFirstUseCounter +
12449-
uc * 2 + 1);
12450-
value = GetUseCounter(uc) || GetChildDocumentUseCounter(uc);
12451-
12452-
if (value) {
12453-
if (sDebugUseCounters) {
12454-
const char* name = Telemetry::GetHistogramName(id);
12455-
if (name) {
12456-
printf(" %s", name);
12457-
} else {
12458-
printf(" #%d", id);
12459-
}
12460-
printf(": %d\n", value);
12461-
}
12462-
12463-
Telemetry::Accumulate(id, 1);
12464-
}
12465-
}
12466-
}
12467-
}
12372+
/* STUB */
1246812373
}
1246912374

1247012375
void

dom/base/nsFrameMessageManager.cpp

-8
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include "mozilla/CycleCollectedJSContext.h"
3333
#include "mozilla/IntentionalCrash.h"
3434
#include "mozilla/Preferences.h"
35-
#include "mozilla/Telemetry.h"
3635
#include "mozilla/dom/File.h"
3736
#include "mozilla/dom/MessagePort.h"
3837
#include "mozilla/dom/nsIContentParent.h"
@@ -716,9 +715,6 @@ AllowMessage(size_t aDataLength, const nsAString& aMessageName)
716715
NS_ConvertUTF16toUTF8 messageName(aMessageName);
717716
messageName.StripChars("0123456789");
718717

719-
Telemetry::Accumulate(Telemetry::MESSAGE_MANAGER_MESSAGE_SIZE2, messageName,
720-
aDataLength);
721-
722718
// A message includes more than structured clone data, so subtract
723719
// 20KB to make it more likely that a message within this bound won't
724720
// result in an overly large IPC message.
@@ -727,9 +723,6 @@ AllowMessage(size_t aDataLength, const nsAString& aMessageName)
727723
return true;
728724
}
729725

730-
Telemetry::Accumulate(Telemetry::REJECTED_MESSAGE_MANAGER_MESSAGE,
731-
messageName);
732-
733726
return false;
734727
}
735728

@@ -2248,7 +2241,6 @@ nsSameProcessAsyncMessageBase::Init(const nsAString& aMessage,
22482241
nsIPrincipal* aPrincipal)
22492242
{
22502243
if (!mData.Copy(aData)) {
2251-
Telemetry::Accumulate(Telemetry::IPC_SAME_PROCESS_MESSAGE_COPY_OOM_KB, aData.DataLength());
22522244
return NS_ERROR_OUT_OF_MEMORY;
22532245
}
22542246

0 commit comments

Comments
 (0)