Skip to content

Commit

Permalink
Close mozilla-mobile#26320: Make Nimbus first-startup comments clear …
Browse files Browse the repository at this point in the history
…in FenixApplication
  • Loading branch information
jonalmeida committed Nov 21, 2022
1 parent 9671d0a commit 57b8eba
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions app/src/main/java/org/mozilla/fenix/FenixApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()

Expand Down Expand Up @@ -246,6 +250,8 @@ open class FenixApplication : LocaleAwareApplication(), Provider {
initVisualCompletenessQueueAndQueueTasks()

ProcessLifecycleOwner.get().lifecycle.addObserver(TelemetryLifecycleObserver(components.core.store))

downloadWallpapers()
}

@OptIn(DelicateCoroutinesApi::class) // GlobalScope usage
Expand Down

0 comments on commit 57b8eba

Please sign in to comment.