Global Metrics
path: .metrics.cognitive.average
old: 1.25
new: 2.642857142857143
path: .metrics.cognitive.sum
old: 5.0
new: 37.0
path: .metrics.nargs.sum
old: 13.0
new: 8.0
path: .metrics.nargs.average
old: 3.25
new: 0.5714285714285714
path: .metrics.cyclomatic.average
old: 1.6666666666666667
new: 3.0
path: .metrics.cyclomatic.sum
old: 10.0
new: 45.0
path: .metrics.halstead.volume
old: 1918.1137466271807
new: 6659.136669114062
path: .metrics.halstead.difficulty
old: 22.333333333333332
new: 30.36470588235294
path: .metrics.halstead.effort
old: 42837.8736746737
new: 202202.7263880399
path: .metrics.halstead.N1
old: 173.0
new: 516.0
path: .metrics.halstead.level
old: 0.04477611940298508
new: 0.032932971716388995
path: .metrics.halstead.purity_ratio
old: 1.3458806304977795
new: 1.6060526467914091
path: .metrics.halstead.vocabulary
old: 76.0
new: 199.0
path: .metrics.halstead.estimated_program_length
old: 413.1853535628184
new: 1400.4779080021087
path: .metrics.halstead.N2
old: 134.0
new: 356.0
path: .metrics.halstead.length
old: 307.0
new: 872.0
path: .metrics.halstead.bugs
old: 0.40809757660024454
new: 1.1483389172527418
path: .metrics.halstead.time
old: 2379.8818708152053
new: 11233.48479933555
path: .metrics.halstead.n2
old: 57.0
new: 170.0
path: .metrics.halstead.n1
old: 19.0
new: 29.0
path: .metrics.loc.lloc
old: 18.0
new: 86.0
path: .metrics.loc.blank
old: 16.0
new: 27.0
path: .metrics.loc.cloc
old: 11.0
new: 39.0
path: .metrics.loc.sloc
old: 85.0
new: 309.0
path: .metrics.loc.ploc
old: 58.0
new: 243.0
path: .metrics.mi.mi_original
old: 57.42174234067893
new: 21.99039665973416
path: .metrics.mi.mi_sei
old: 34.60443157548037
new: -13.243178413147678
path: .metrics.mi.mi_visual_studio
old: 33.57996628109879
new: 12.859881087563837
path: .metrics.nexits.sum
old: 7.0
new: 10.0
path: .metrics.nexits.average
old: 1.75
new: 0.7142857142857143
path: .metrics.nom.closures
old: 0.0
new: 1.0
path: .metrics.nom.total
old: 4.0
new: 14.0
path: .metrics.nom.functions
old: 4.0
new: 13.0
Spaces Data
Minimal test - lines (99, 99)
path: .spaces[0].spaces[1].metrics.mi.mi_visual_studio
old: 68.10625337613413
new: 90.2012398141466
path: .spaces[0].spaces[1].metrics.mi.mi_original
old: 116.46169327318938
new: 154.24412008219068
path: .spaces[0].spaces[1].metrics.mi.mi_sei
old: 92.4196752061536
new: 146.92819499625
path: .spaces[0].spaces[1].metrics.loc.sloc
old: 6.0
new: 1.0
path: .spaces[0].spaces[1].metrics.loc.ploc
old: 6.0
new: 1.0
path: .spaces[0].spaces[1].metrics.halstead.N2
old: 14.0
new: 2.0
path: .spaces[0].spaces[1].metrics.halstead.level
old: 0.17857142857142858
new: 0.3333333333333333
path: .spaces[0].spaces[1].metrics.halstead.purity_ratio
old: 1.8457832564152783
new: 2.188721875540867
path: .spaces[0].spaces[1].metrics.halstead.n1
old: 8.0
new: 6.0
path: .spaces[0].spaces[1].metrics.halstead.estimated_program_length
old: 57.219280948873624
new: 17.509775004326936
path: .spaces[0].spaces[1].metrics.halstead.effort
old: 723.8989802503853
new: 72.0
path: .spaces[0].spaces[1].metrics.halstead.n2
old: 10.0
new: 2.0
path: .spaces[0].spaces[1].metrics.halstead.bugs
old: 0.026873901550463184
new: 0.0057689982812296325
path: .spaces[0].spaces[1].metrics.halstead.length
old: 31.0
new: 8.0
path: .spaces[0].spaces[1].metrics.halstead.time
old: 40.2166100139103
new: 4.0
path: .spaces[0].spaces[1].metrics.halstead.N1
old: 17.0
new: 6.0
path: .spaces[0].spaces[1].metrics.halstead.vocabulary
old: 18.0
new: 8.0
path: .spaces[0].spaces[1].metrics.halstead.difficulty
old: 5.6
new: 3.0
path: .spaces[0].spaces[1].metrics.halstead.volume
old: 129.26767504471167
new: 24.0
path: .spaces[0].spaces[1].metrics.nargs.sum
old: 4.0
new: 0.0
path: .spaces[0].spaces[1].metrics.nargs.average
old: 4.0
new: 0.0
Code
bool AppShutdown::IsShuttingDown() { return sIsShuttingDown; }
Minimal test - lines (101, 101)
path: .spaces[0].spaces[2].metrics.halstead.length
old: 36.0
new: 8.0
path: .spaces[0].spaces[2].metrics.halstead.estimated_program_length
old: 67.01955000865388
new: 17.509775004326936
path: .spaces[0].spaces[2].metrics.halstead.bugs
old: 0.030649063926827792
new: 0.0057689982812296325
path: .spaces[0].spaces[2].metrics.halstead.purity_ratio
old: 1.8616541669070523
new: 2.188721875540867
path: .spaces[0].spaces[2].metrics.halstead.effort
old: 881.673331357022
new: 72.0
path: .spaces[0].spaces[2].metrics.halstead.N1
old: 19.0
new: 6.0
path: .spaces[0].spaces[2].metrics.halstead.time
old: 48.981851742056776
new: 4.0
path: .spaces[0].spaces[2].metrics.halstead.vocabulary
old: 20.0
new: 8.0
path: .spaces[0].spaces[2].metrics.halstead.n1
old: 8.0
new: 6.0
path: .spaces[0].spaces[2].metrics.halstead.volume
old: 155.58941141594505
new: 24.0
path: .spaces[0].spaces[2].metrics.halstead.difficulty
old: 5.666666666666667
new: 3.0
path: .spaces[0].spaces[2].metrics.halstead.n2
old: 12.0
new: 2.0
path: .spaces[0].spaces[2].metrics.halstead.level
old: 0.1764705882352941
new: 0.3333333333333333
path: .spaces[0].spaces[2].metrics.halstead.N2
old: 17.0
new: 2.0
path: .spaces[0].spaces[2].metrics.nargs.sum
old: 5.0
new: 0.0
path: .spaces[0].spaces[2].metrics.nargs.average
old: 5.0
new: 0.0
path: .spaces[0].spaces[2].metrics.mi.mi_sei
old: 120.58564297820168
new: 146.92819499625
path: .spaces[0].spaces[2].metrics.mi.mi_original
old: 115.49794968961136
new: 154.24412008219068
path: .spaces[0].spaces[2].metrics.mi.mi_visual_studio
old: 67.54266063719962
new: 90.2012398141466
path: .spaces[0].spaces[2].metrics.loc.cloc
old: 1.0
new: 0.0
path: .spaces[0].spaces[2].metrics.loc.sloc
old: 6.0
new: 1.0
path: .spaces[0].spaces[2].metrics.loc.ploc
old: 5.0
new: 1.0
Code
int AppShutdown::GetExitCode() { return sExitCode; }
Minimal test - lines (42, 309)
path: .spaces[0].metrics.cyclomatic.average
old: 1.8
new: 3.142857142857143
path: .spaces[0].metrics.cyclomatic.sum
old: 9.0
new: 44.0
path: .spaces[0].metrics.halstead.volume
old: 1826.4488125766725
new: 6353.759594897354
path: .spaces[0].metrics.halstead.level
old: 0.04177109440267335
new: 0.03106554830692762
path: .spaces[0].metrics.halstead.N2
old: 126.0
new: 333.0
path: .spaces[0].metrics.halstead.purity_ratio
old: 1.2137238536594124
new: 1.4431145493911444
path: .spaces[0].metrics.halstead.estimated_program_length
old: 362.9034322441643
new: 1225.2042524330816
path: .spaces[0].metrics.halstead.N1
old: 173.0
new: 516.0
path: .spaces[0].metrics.halstead.bugs
old: 0.41371364622993406
new: 1.157124037351947
path: .spaces[0].metrics.halstead.n1
old: 19.0
new: 29.0
path: .spaces[0].metrics.halstead.effort
old: 43725.18457308554
new: 204527.52135974585
path: .spaces[0].metrics.halstead.n2
old: 50.0
new: 150.0
path: .spaces[0].metrics.halstead.difficulty
old: 23.94
new: 32.19
path: .spaces[0].metrics.halstead.time
old: 2429.1769207269745
new: 11362.640075541434
path: .spaces[0].metrics.halstead.length
old: 299.0
new: 849.0
path: .spaces[0].metrics.halstead.vocabulary
old: 69.0
new: 179.0
path: .spaces[0].metrics.nexits.average
old: 1.75
new: 0.7142857142857143
path: .spaces[0].metrics.nexits.sum
old: 7.0
new: 10.0
path: .spaces[0].metrics.loc.cloc
old: 4.0
new: 32.0
path: .spaces[0].metrics.loc.ploc
old: 48.0
new: 214.0
path: .spaces[0].metrics.loc.sloc
old: 63.0
new: 268.0
path: .spaces[0].metrics.loc.lloc
old: 18.0
new: 86.0
path: .spaces[0].metrics.loc.blank
old: 11.0
new: 22.0
path: .spaces[0].metrics.nom.closures
old: 0.0
new: 1.0
path: .spaces[0].metrics.nom.total
old: 4.0
new: 14.0
path: .spaces[0].metrics.nom.functions
old: 4.0
new: 13.0
path: .spaces[0].metrics.nargs.sum
old: 13.0
new: 8.0
path: .spaces[0].metrics.nargs.average
old: 3.25
new: 0.5714285714285714
path: .spaces[0].metrics.cognitive.sum
old: 5.0
new: 37.0
path: .spaces[0].metrics.cognitive.average
old: 1.25
new: 2.642857142857143
path: .spaces[0].metrics.mi.mi_original
old: 62.75854756339457
new: 24.77064062557085
path: .spaces[0].metrics.mi.mi_sei
old: 34.78304132201173
new: -9.978496409587825
path: .spaces[0].metrics.mi.mi_visual_studio
old: 36.70090500783308
new: 14.48575475179582
Code
namespace mozilla {
const char* sPhaseObserverKeys[] = {
nullptr, // NotInShutdown
"quit-application", // AppShutdownConfirmed
"profile-change-net-teardown", // AppShutdownNetTeardown
"profile-change-teardown", // AppShutdownTeardown
"profile-before-change", // AppShutdown
"profile-before-change-qm", // AppShutdownQM
"profile-before-change-telemetry", // AppShutdownTelemetry
"xpcom-will-shutdown", // XPCOMWillShutdown
"xpcom-shutdown", // XPCOMShutdown
"xpcom-shutdown-threads", // XPCOMShutdownThreads
nullptr, // XPCOMShutdownLoaders
nullptr, // XPCOMShutdownFinal
nullptr // CCPostLastCycleCollection
};
static_assert(sizeof(sPhaseObserverKeys) / sizeof(sPhaseObserverKeys[0]) ==
(size_t)ShutdownPhase::ShutdownPhase_Length);
#ifndef ANDROID
static nsTerminator* sTerminator = nullptr;
#endif
static ShutdownPhase sFastShutdownPhase = ShutdownPhase::NotInShutdown;
static ShutdownPhase sLateWriteChecksPhase = ShutdownPhase::NotInShutdown;
static AppShutdownMode sShutdownMode = AppShutdownMode::Normal;
static Atomic sIsShuttingDown;
static int sExitCode = 0;
// These environment variable strings are all deliberately copied and leaked
// due to requirements of PR_SetEnv and similar.
static char* sSavedXulAppFile = nullptr;
#ifdef XP_WIN
static wchar_t* sSavedProfDEnvVar = nullptr;
static wchar_t* sSavedProfLDEnvVar = nullptr;
#else
static char* sSavedProfDEnvVar = nullptr;
static char* sSavedProfLDEnvVar = nullptr;
#endif
ShutdownPhase GetShutdownPhaseFromPrefValue(int32_t aPrefValue) {
switch (aPrefValue) {
case 1:
return ShutdownPhase::CCPostLastCycleCollection;
case 2:
return ShutdownPhase::XPCOMShutdownThreads;
case 3:
return ShutdownPhase::XPCOMShutdown;
// NOTE: the remaining values from the ShutdownPhase enum will be added
// when we're at least reasonably confident that the world won't come
// crashing down if we do a fast shutdown at that point.
}
return ShutdownPhase::NotInShutdown;
}
bool AppShutdown::IsShuttingDown() { return sIsShuttingDown; }
int AppShutdown::GetExitCode() { return sExitCode; }
void AppShutdown::SaveEnvVarsForPotentialRestart() {
const char* s = PR_GetEnv("XUL_APP_FILE");
if (s) {
sSavedXulAppFile = Smprintf("%s=%s", "XUL_APP_FILE", s).release();
MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(sSavedXulAppFile);
}
}
const char* AppShutdown::GetObserverKey(ShutdownPhase aPhase) {
return sPhaseObserverKeys[static_cast>(
aPhase)];
}
void AppShutdown::MaybeDoRestart() {
if (sShutdownMode == AppShutdownMode::Restart) {
StopLateWriteChecks();
// Since we'll be launching our child while we're still alive, make sure
// we've unlocked the profile first, otherwise the child could hit its
// profile lock check before we've exited and thus released our lock.
UnlockProfile();
if (sSavedXulAppFile) {
PR_SetEnv(sSavedXulAppFile);
}
#ifdef XP_WIN
if (sSavedProfDEnvVar && !EnvHasValue("XRE_PROFILE_PATH")) {
SetEnvironmentVariableW(L"XRE_PROFILE_PATH", sSavedProfDEnvVar);
}
if (sSavedProfLDEnvVar && !EnvHasValue("XRE_PROFILE_LOCAL_PATH")) {
SetEnvironmentVariableW(L"XRE_PROFILE_LOCAL_PATH", sSavedProfLDEnvVar);
}
#else
if (sSavedProfDEnvVar && !EnvHasValue("XRE_PROFILE_PATH")) {
PR_SetEnv(sSavedProfDEnvVar);
}
if (sSavedProfLDEnvVar && !EnvHasValue("XRE_PROFILE_LOCAL_PATH")) {
PR_SetEnv(sSavedProfLDEnvVar);
}
#endif
LaunchChild(true);
}
}
#ifdef XP_WIN
wchar_t* CopyPathIntoNewWCString(nsIFile* aFile) {
wchar_t* result = nullptr;
nsAutoString resStr;
aFile->GetPath(resStr);
if (resStr.Length() > 0) {
result = (wchar_t*)malloc((resStr.Length() + 1) * sizeof(wchar_t));
if (result) {
wcscpy(result, resStr.get());
result[resStr.Length()] = 0;
}
}
return result;
}
#endif
void AppShutdown::Init(AppShutdownMode aMode, int aExitCode) {
if (sShutdownMode == AppShutdownMode::Normal) {
sShutdownMode = aMode;
}
sExitCode = aExitCode;
#ifndef ANDROID
sTerminator = new nsTerminator();
#endif
// Late-write checks needs to find the profile directory, so it has to
// be initialized before services::Shutdown or (because of
// xpcshell tests replacing the service) modules being unloaded.
InitLateWriteChecks();
int32_t fastShutdownPref = StaticPrefs::toolkit_shutdown_fastShutdownStage();
sFastShutdownPhase = GetShutdownPhaseFromPrefValue(fastShutdownPref);
int32_t lateWriteChecksPref =
StaticPrefs::toolkit_shutdown_lateWriteChecksStage();
sLateWriteChecksPhase = GetShutdownPhaseFromPrefValue(lateWriteChecksPref);
// Very early shutdowns can happen before the startup cache is even
// initialized; don't bother initializing it during shutdown.
if (auto* cache = scache::StartupCache::GetSingletonNoInit()) {
cache->MaybeInitShutdownWrite();
}
}
void AppShutdown::MaybeFastShutdown(ShutdownPhase aPhase) {
// For writes which we want to ensure are recorded, we don't want to trip
// the late write checking code. Anything that writes to disk and which
// we don't want to skip should be listed out explicitly in this section.
if (aPhase == sFastShutdownPhase || aPhase == sLateWriteChecksPhase) {
if (auto* cache = scache::StartupCache::GetSingletonNoInit()) {
cache->EnsureShutdownWriteComplete();
}
nsresult rv;
#ifdef MOZ_NEW_XULSTORE
rv = XULStore::Shutdown();
NS_ASSERTION(NS_SUCCEEDED(rv), "XULStore::Shutdown() failed.");
#endif
nsCOMPtr certStorage =
do_GetService("@mozilla.org/security/certstorage;1", &rv);
if (NS_SUCCEEDED(rv)) {
SpinEventLoopUntil([&]() {
int32_t remainingOps;
nsresult rv = certStorage->GetRemainingOperationCount(&remainingOps);
NS_ASSERTION(NS_SUCCEEDED(rv),
"nsICertStorage::getRemainingOperationCount failed during "
"shutdown");
return NS_FAILED(rv) || remainingOps <= 0;
});
}
}
if (aPhase == sFastShutdownPhase) {
StopLateWriteChecks();
RecordShutdownEndTimeStamp();
MaybeDoRestart();
#ifdef MOZ_GECKO_PROFILER
profiler_shutdown(IsFastShutdown::Yes);
#endif
DoImmediateExit(sExitCode);
} else if (aPhase == sLateWriteChecksPhase) {
#ifdef XP_MACOSX
OnlyReportDirtyWrites();
#endif /* XP_MACOSX */
BeginLateWriteChecks();
}
}
void AppShutdown::OnShutdownConfirmed() {
sIsShuttingDown = true;
// If we're restarting, we need to save environment variables correctly
// while everything is still alive to do so.
if (sShutdownMode == AppShutdownMode::Restart) {
nsCOMPtr profD;
nsCOMPtr profLD;
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profD));
NS_GetSpecialDirectory(NS_APP_USER_PROFILE_LOCAL_50_DIR,
getter_AddRefs(profLD));
#ifdef XP_WIN
sSavedProfDEnvVar = CopyPathIntoNewWCString(profD);
sSavedProfLDEnvVar = CopyPathIntoNewWCString(profLD);
#else
nsAutoCString profDStr;
profD->GetNativePath(profDStr);
sSavedProfDEnvVar =
Smprintf("XRE_PROFILE_PATH=%s", profDStr.get()).release();
nsAutoCString profLDStr;
profLD->GetNativePath(profLDStr);
sSavedProfLDEnvVar =
Smprintf("XRE_PROFILE_LOCAL_PATH=%s", profLDStr.get()).release();
#endif
MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(sSavedProfDEnvVar);
MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(sSavedProfLDEnvVar);
}
}
void AppShutdown::DoImmediateExit(int aExitCode) {
#ifdef XP_WIN
HANDLE process = ::GetCurrentProcess();
if (::TerminateProcess(process, aExitCode)) {
::WaitForSingleObject(process, INFINITE);
}
MOZ_CRASH("TerminateProcess failed.");
#else
_exit(aExitCode);
#endif
}
bool AppShutdown::IsRestarting() {
return sShutdownMode == AppShutdownMode::Restart;
}
void AppShutdown::AdvanceShutdownPhase(
ShutdownPhase aPhase, const char16_t* aNotificationData,
nsCOMPtr aNotificationSubject) {
#ifndef ANDROID
if (sTerminator) {
sTerminator->AdvancePhase(aPhase);
}
#endif
mozilla::KillClearOnShutdown(aPhase);
MaybeFastShutdown(aPhase);
const char* aTopic = AppShutdown::GetObserverKey(aPhase);
if (aTopic) {
nsCOMPtr obsService =
mozilla::services::GetObserverService();
if (obsService) {
obsService->NotifyObservers(aNotificationSubject, aTopic,
aNotificationData);
}
}
}
} // namespace mozilla
Minimal test - lines (103, 109)
path: .spaces[0].spaces[3].metrics.cyclomatic.sum
old: 5.0
new: 2.0
path: .spaces[0].spaces[3].metrics.cyclomatic.average
old: 5.0
new: 2.0
path: .spaces[0].spaces[3].metrics.loc.sloc
old: 38.0
new: 7.0
path: .spaces[0].spaces[3].metrics.loc.blank
old: 6.0
new: 0.0
path: .spaces[0].spaces[3].metrics.loc.lloc
old: 14.0
new: 3.0
path: .spaces[0].spaces[3].metrics.loc.cloc
old: 3.0
new: 0.0
path: .spaces[0].spaces[3].metrics.loc.ploc
old: 29.0
new: 7.0
path: .spaces[0].spaces[3].metrics.mi.mi_sei
old: 53.46986240751435
new: 87.75489591736567
path: .spaces[0].spaces[3].metrics.mi.mi_original
old: 74.56748372793686
new: 113.1577385127604
path: .spaces[0].spaces[3].metrics.mi.mi_visual_studio
old: 43.606715630372435
new: 66.17411608933357
path: .spaces[0].spaces[3].metrics.cognitive.average
old: 5.0
new: 1.0
path: .spaces[0].spaces[3].metrics.cognitive.sum
old: 5.0
new: 1.0
path: .spaces[0].spaces[3].metrics.halstead.n2
old: 37.0
new: 9.0
path: .spaces[0].spaces[3].metrics.halstead.time
old: 1116.271183605951
new: 57.95012225129829
path: .spaces[0].spaces[3].metrics.halstead.estimated_program_length
old: 267.8084245542328
new: 61.74860596185444
path: .spaces[0].spaces[3].metrics.halstead.bugs
old: 0.24636190735128896
new: 0.0342844078613968
path: .spaces[0].spaces[3].metrics.halstead.n1
old: 18.0
new: 10.0
path: .spaces[0].spaces[3].metrics.halstead.vocabulary
old: 55.0
new: 19.0
path: .spaces[0].spaces[3].metrics.halstead.purity_ratio
old: 1.424512896565068
new: 1.816135469466307
path: .spaces[0].spaces[3].metrics.halstead.N1
old: 112.0
new: 21.0
path: .spaces[0].spaces[3].metrics.halstead.effort
old: 20092.88130490711
new: 1043.1022005233692
path: .spaces[0].spaces[3].metrics.halstead.difficulty
old: 18.486486486486488
new: 7.222222222222222
path: .spaces[0].spaces[3].metrics.halstead.length
old: 188.0
new: 34.0
path: .spaces[0].spaces[3].metrics.halstead.volume
old: 1086.895626142636
new: 144.4295354570819
path: .spaces[0].spaces[3].metrics.halstead.level
old: 0.054093567251461985
new: 0.13846153846153847
path: .spaces[0].spaces[3].metrics.halstead.N2
old: 76.0
new: 13.0
path: .spaces[0].spaces[3].metrics.nexits.sum
old: 4.0
new: 0.0
path: .spaces[0].spaces[3].metrics.nexits.average
old: 4.0
new: 0.0
Code
void AppShutdown::SaveEnvVarsForPotentialRestart() {
const char* s = PR_GetEnv("XUL_APP_FILE");
if (s) {
sSavedXulAppFile = Smprintf("%s=%s", "XUL_APP_FILE", s).release();
MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(sSavedXulAppFile);
}
}
Minimal test - lines (84, 97)
path: .spaces[0].spaces[0].metrics.nargs.sum
old: 4.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nargs.average
old: 4.0
new: 1.0
path: .spaces[0].spaces[0].metrics.nexits.average
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.nexits.sum
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.halstead.purity_ratio
old: 2.1696491986782873
new: 1.7642458846244125
path: .spaces[0].spaces[0].metrics.halstead.bugs
old: 0.04598516146528687
new: 0.027171418130132206
path: .spaces[0].spaces[0].metrics.halstead.estimated_program_length
old: 91.12526634448808
new: 61.74860596185444
path: .spaces[0].spaces[0].metrics.halstead.n1
old: 12.0
new: 9.0
path: .spaces[0].spaces[0].metrics.halstead.difficulty
old: 8.307692307692308
new: 4.95
path: .spaces[0].spaces[0].metrics.halstead.n2
old: 13.0
new: 10.0
path: .spaces[0].spaces[0].metrics.halstead.effort
old: 1620.3485905244731
new: 735.9534417041011
path: .spaces[0].spaces[0].metrics.halstead.vocabulary
old: 25.0
new: 19.0
path: .spaces[0].spaces[0].metrics.halstead.length
old: 42.0
new: 35.0
path: .spaces[0].spaces[0].metrics.halstead.volume
old: 195.0419599705384
new: 148.67746297052548
path: .spaces[0].spaces[0].metrics.halstead.N2
old: 18.0
new: 11.0
path: .spaces[0].spaces[0].metrics.halstead.level
old: 0.12037037037037036
new: 0.202020202020202
path: .spaces[0].spaces[0].metrics.halstead.time
old: 90.01936614024851
new: 40.88630231689451
path: .spaces[0].spaces[0].metrics.cyclomatic.sum
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.cyclomatic.average
old: 1.0
new: 4.0
path: .spaces[0].spaces[0].metrics.mi.mi_sei
old: 89.33387575203645
new: 103.73891487930167
path: .spaces[0].spaces[0].metrics.mi.mi_visual_studio
old: 66.85542694841793
new: 59.25030350640257
path: .spaces[0].spaces[0].metrics.mi.mi_original
old: 114.32278008179466
new: 101.3180189959484
path: .spaces[0].spaces[0].metrics.cognitive.average
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.cognitive.sum
old: 0.0
new: 1.0
path: .spaces[0].spaces[0].metrics.loc.sloc
old: 6.0
new: 14.0
path: .spaces[0].spaces[0].metrics.loc.cloc
old: 0.0
new: 3.0
path: .spaces[0].spaces[0].metrics.loc.lloc
old: 2.0
new: 8.0
path: .spaces[0].spaces[0].metrics.loc.ploc
old: 6.0
new: 11.0
Code
ShutdownPhase GetShutdownPhaseFromPrefValue(int32_t aPrefValue) {
switch (aPrefValue) {
case 1:
return ShutdownPhase::CCPostLastCycleCollection;
case 2:
return ShutdownPhase::XPCOMShutdownThreads;
case 3:
return ShutdownPhase::XPCOMShutdown;
// NOTE: the remaining values from the ShutdownPhase enum will be added
// when we're at least reasonably confident that the world won't come
// crashing down if we do a fast shutdown at that point.
}
return ShutdownPhase::NotInShutdown;
}