Close #26320: Make Nimbus first-startup comments clear in FenixApplication

This commit is contained in:
Jonathan Almeida 2022-11-21 11:20:37 -05:00 committed by mergify[bot]
parent fc8b6788d3
commit 6d9808a067
1 changed files with 15 additions and 9 deletions

View File

@ -131,16 +131,9 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
return
}
// We can initialize Nimbus before Glean because Glean will queue messages
// before it's initialized.
initializeNimbus()
// We need to always initialize Glean and do it early here.
initializeGlean()
// DO NOT ADD ANYTHING ABOVE HERE.
setupInMainProcessOnly()
downloadWallpapers()
// DO NOT ADD ANYTHING UNDER HERE.
// DO NOT MOVE ANYTHING BELOW THIS elapsedRealtimeNanos CALL.
val stop = SystemClock.elapsedRealtimeNanos()
@ -198,9 +191,20 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
@CallSuper
open fun setupInMainProcessOnly() {
// ⚠️ DO NOT ADD ANYTHING ABOVE THIS LINE.
// Especially references to the engine/BrowserStore which can alter the app initialization.
// See: https://github.com/mozilla-mobile/fenix/issues/26320
//
// We can initialize Nimbus before Glean because Glean will queue messages
// before it's initialized.
initializeNimbus()
ProfilerMarkerFactProcessor.create { components.core.engine.profiler }.register()
run {
// We need to always initialize Glean and do it early here.
initializeGlean()
// Attention: Do not invoke any code from a-s in this scope.
val megazordSetup = finishSetupMegazord()
@ -246,6 +250,8 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
initVisualCompletenessQueueAndQueueTasks()
ProcessLifecycleOwner.get().lifecycle.addObserver(TelemetryLifecycleObserver(components.core.store))
downloadWallpapers()
}
@OptIn(DelicateCoroutinesApi::class) // GlobalScope usage