Issue #21 - Remove Telemetry plumbing and fix build.

Note this won't give working applications. Requires FE changes and
additional js module changes (next part).
This commit is contained in:
Moonchild 2021-10-29 11:02:27 +00:00 committed by roytam1
commit 8d800b1cb0
205 changed files with 45 additions and 40519 deletions

View file

@ -19,7 +19,6 @@
#include "mozilla/ScopeExit.h"
#include "mozilla/Services.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/Telemetry.h"
#include "nsAppRunner.h"
#include "mozilla/AppData.h"
@ -1572,8 +1571,6 @@ ProfileLockedDialog(nsIFile* aProfileDir, nsIFile* aProfileLocalDir,
rv = xpcom.Initialize();
NS_ENSURE_SUCCESS(rv, rv);
mozilla::Telemetry::WriteFailedProfileLock(aProfileDir);
rv = xpcom.SetWindowCreator(aNative);
NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
@ -3032,25 +3029,16 @@ namespace mozilla {
} // namespace mozilla
static void SetShutdownChecks() {
// Set default first. On debug builds we crash. On nightly and local
// builds we record. Nightlies will then send the info via telemetry,
// but it is usefull to have the data in about:telemetry in local builds
// too.
// Set default first. On debug builds we crash.
#ifdef DEBUG
gShutdownChecks = SCM_CRASH;
#else
const char* releaseChannel = NS_STRINGIFY(MOZ_UPDATE_CHANNEL);
if (strcmp(releaseChannel, "nightly") == 0 ||
strcmp(releaseChannel, "default") == 0) {
gShutdownChecks = SCM_RECORD;
} else {
gShutdownChecks = SCM_NOTHING;
}
gShutdownChecks = SCM_NOTHING;
#endif
// We let an environment variable override the default so that addons
// authors can use it for debugging shutdown with released firefox versions.
// authors can use it for debugging shutdown with released application versions.
const char* mozShutdownChecksEnv = PR_GetEnv("MOZ_SHUTDOWN_CHECKS");
if (mozShutdownChecksEnv) {
if (strcmp(mozShutdownChecksEnv, "crash") == 0) {
@ -3080,19 +3068,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
SetShutdownChecks();
// Enable Telemetry IO Reporting on DEBUG, nightly and local builds
#ifdef DEBUG
mozilla::Telemetry::InitIOReporting(gAppData->xreDirectory);
#else
{
const char* releaseChannel = NS_STRINGIFY(MOZ_UPDATE_CHANNEL);
if (strcmp(releaseChannel, "nightly") == 0 ||
strcmp(releaseChannel, "default") == 0) {
mozilla::Telemetry::InitIOReporting(gAppData->xreDirectory);
}
}
#endif /* DEBUG */
#if defined(MOZ_WIDGET_GTK) || defined(MOZ_ENABLE_XREMOTE)
// Stash DESKTOP_STARTUP_ID in malloc'ed memory because gtk_init will clear it.
#define HAVE_DESKTOP_STARTUP_ID
@ -3408,8 +3383,6 @@ XREMain::XRE_mainStartup(bool* aExitFlag)
//////////////////////// NOW WE HAVE A PROFILE ////////////////////////
mozilla::Telemetry::SetProfileDir(mProfD);
nsAutoCString version;
BuildVersion(version);
@ -3803,15 +3776,6 @@ void XRE_GlibInit()
}
#endif
// Separate stub function to let us specifically suppress it in Valgrind
void
XRE_CreateStatsObject()
{
// Initialize global variables used by histogram collection
// machinery that is used by by Telemetry. Note: is never de-initialised.
Telemetry::CreateStatisticsRecorder();
}
/*
* XRE_main - A class based main entry point used by most platforms.
* Note that on OSX, aAppData->xreDirectory will point to
@ -3822,16 +3786,6 @@ XREMain::XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
{
ScopedLogging log;
// NB: this must happen after the creation of |ScopedLogging log| since
// ScopedLogging::ScopedLogging calls NS_LogInit, and
// XRE_CreateStatsObject calls Telemetry::CreateStatisticsRecorder,
// and NS_LogInit must be called before Telemetry::CreateStatisticsRecorder.
// NS_LogInit must be called before Telemetry::CreateStatisticsRecorder
// so as to avoid many log messages of the form
// WARNING: XPCOM objects created/destroyed from static ctor/dtor: [..]
// See bug 1279614.
XRE_CreateStatsObject();
char aLocal;
GeckoProfilerInitRAII profilerGuard(&aLocal);
@ -3980,7 +3934,6 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData, uint32_t aFlags)
XREMain main;
int result = main.XRE_main(argc, argv, aAppData);
mozilla::RecordShutdownEndTimeStamp();
return result;
}