@ -68,6 +68,7 @@ import org.mozilla.fenix.TelemetryMiddleware
import org.mozilla.fenix.downloads.DownloadService
import org.mozilla.fenix.ext.components
import org.mozilla.fenix.ext.settings
import org.mozilla.fenix.perf.lazyMonitored
import org.mozilla.fenix.media.MediaService
import org.mozilla.fenix.search.telemetry.ads.AdsTelemetry
import org.mozilla.fenix.search.telemetry.incontent.InContentTelemetry
@ -91,7 +92,7 @@ class Core(
* The browser engine component initialized based on the build
* configuration ( see build variants ) .
* /
val engine : Engine by lazy {
val engine : Engine by lazy Monitored {
val defaultSettings = DefaultSettings (
requestInterceptor = AppRequestInterceptor ( context ) ,
remoteDebuggingEnabled = context . settings ( ) . isRemoteDebuggingEnabled &&
@ -137,7 +138,7 @@ class Core(
/ * *
* [ Client ] implementation to be used for code depending on ` concept - fetch ` `
* /
val client : Client by lazy {
val client : Client by lazy Monitored {
GeckoViewFetchClient (
context ,
GeckoProvider . getOrCreateRuntime (
@ -148,14 +149,14 @@ class Core(
)
}
private val sessionStorage : SessionStorage by lazy {
private val sessionStorage : SessionStorage by lazy Monitored {
SessionStorage ( context , engine = engine )
}
/ * *
* The [ BrowserStore ] holds the global [ BrowserState ] .
* /
val store by lazy {
val store by lazy Monitored {
BrowserStore (
middleware = listOf (
RecentlyClosedMiddleware ( context , RECENTLY _CLOSED _MAX , engine ) ,
@ -186,12 +187,12 @@ class Core(
/ * *
* The [ CustomTabsServiceStore ] holds global custom tabs related data .
* /
val customTabsStore by lazy { CustomTabsServiceStore ( ) }
val customTabsStore by lazy Monitored { CustomTabsServiceStore ( ) }
/ * *
* The [ RelationChecker ] checks Digital Asset Links relationships for Trusted Web Activities .
* /
val relationChecker : RelationChecker by lazy {
val relationChecker : RelationChecker by lazy Monitored {
StatementRelationChecker ( StatementApi ( client ) )
}
@ -201,7 +202,7 @@ class Core(
* sessions from the [ SessionStorage ] , and with a default session ( about : blank ) in
* case all sessions / tabs are closed .
* /
val sessionManager by lazy {
val sessionManager by lazy Monitored {
SessionManager ( engine , store ) . also { sessionManager ->
// Install the "icons" WebExtension to automatically load icons for every visited website.
icons . install ( engine , store )
@ -260,26 +261,26 @@ class Core(
/ * *
* Icons component for loading , caching and processing website icons .
* /
val icons by lazy {
val icons by lazy Monitored {
BrowserIcons ( context , client )
}
val metrics by lazy {
val metrics by lazy Monitored {
context . components . analytics . metrics
}
val adsTelemetry by lazy {
val adsTelemetry by lazy Monitored {
AdsTelemetry ( metrics )
}
val searchTelemetry by lazy {
val searchTelemetry by lazy Monitored {
InContentTelemetry ( metrics )
}
/ * *
* Shortcut component for managing shortcuts on the device home screen .
* /
val webAppShortcutManager by lazy {
val webAppShortcutManager by lazy Monitored {
WebAppShortcutManager (
context ,
client ,
@ -302,11 +303,11 @@ class Core(
val lazyRemoteTabsStorage = lazy { RemoteTabsStorage ( ) }
// For most other application code (non-startup), these wrappers are perfectly fine and more ergonomic.
val historyStorage by lazy { lazyHistoryStorage . value }
val bookmarksStorage by lazy { lazyBookmarksStorage . value }
val passwordsStorage by lazy { lazyPasswordsStorage . value }
val historyStorage by lazy Monitored { lazyHistoryStorage . value }
val bookmarksStorage by lazy Monitored { lazyBookmarksStorage . value }
val passwordsStorage by lazy Monitored { lazyPasswordsStorage . value }
val tabCollectionStorage by lazy {
val tabCollectionStorage by lazy Monitored {
TabCollectionStorage (
context ,
sessionManager ,
@ -317,11 +318,11 @@ class Core(
/ * *
* A storage component for persisting thumbnail images of tabs .
* /
val thumbnailStorage by lazy { ThumbnailStorage ( context ) }
val thumbnailStorage by lazy Monitored { ThumbnailStorage ( context ) }
val pinnedSiteStorage by lazy { PinnedSiteStorage ( context ) }
val pinnedSiteStorage by lazy Monitored { PinnedSiteStorage ( context ) }
val topSitesStorage by lazy {
val topSitesStorage by lazy Monitored {
val defaultTopSites = mutableListOf < Pair < String , String > > ( )
strictMode . resetAfter ( StrictMode . allowThreadDiskReads ( ) ) {
@ -360,11 +361,11 @@ class Core(
)
}
val permissionStorage by lazy { PermissionStorage ( context ) }
val permissionStorage by lazy Monitored { PermissionStorage ( context ) }
val webAppManifestStorage by lazy { ManifestStorage ( context ) }
val webAppManifestStorage by lazy Monitored { ManifestStorage ( context ) }
val loginExceptionStorage by lazy { LoginExceptionStorage ( context ) }
val loginExceptionStorage by lazy Monitored { LoginExceptionStorage ( context ) }
/ * *
* Shared Preferences that encrypt / decrypt using Android KeyStore and lib - dataprotect for 23 +
@ -378,7 +379,7 @@ class Core(
forceInsecure = ! Config . channel . isNightlyOrDebug
)
private val passwordsEncryptionKey by lazy {
private val passwordsEncryptionKey by lazy Monitored {
getSecureAbove22Preferences ( ) . getString ( PASSWORDS _KEY )
?: generateEncryptionKey ( KEY _STRENGTH ) . also {
if ( context . settings ( ) . passwordsEncryptionKeyGenerated &&