Perform storage warm-up after visual completeness
parent
20f8b97dcb
commit
9e324fa02a
|
@ -32,6 +32,7 @@ import mozilla.components.support.ktx.android.content.runOnlyInMainProcess
|
||||||
import mozilla.components.support.locale.LocaleAwareApplication
|
import mozilla.components.support.locale.LocaleAwareApplication
|
||||||
import mozilla.components.support.rusthttp.RustHttpConfig
|
import mozilla.components.support.rusthttp.RustHttpConfig
|
||||||
import mozilla.components.support.rustlog.RustLog
|
import mozilla.components.support.rustlog.RustLog
|
||||||
|
import mozilla.components.support.utils.logElapsedTime
|
||||||
import mozilla.components.support.webextensions.WebExtensionSupport
|
import mozilla.components.support.webextensions.WebExtensionSupport
|
||||||
import org.mozilla.fenix.FeatureFlags.webPushIntegration
|
import org.mozilla.fenix.FeatureFlags.webPushIntegration
|
||||||
import org.mozilla.fenix.components.Components
|
import org.mozilla.fenix.components.Components
|
||||||
|
@ -155,9 +156,11 @@ open class FenixApplication : LocaleAwareApplication() {
|
||||||
components.performance.visualCompletenessTaskManager.add {
|
components.performance.visualCompletenessTaskManager.add {
|
||||||
GlobalScope.launch(Dispatchers.IO) {
|
GlobalScope.launch(Dispatchers.IO) {
|
||||||
logger.info("Initializing storage after visual completeness...")
|
logger.info("Initializing storage after visual completeness...")
|
||||||
components.core.lazyHistoryStorage.value
|
logElapsedTime(logger, "Storage initialization") {
|
||||||
components.core.lazyBookmarksStorage.value
|
components.core.historyStorage.warmUp()
|
||||||
components.core.lazyPasswordsStorage.value
|
components.core.bookmarksStorage.warmUp()
|
||||||
|
components.core.passwordsStorage.warmUp()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import mozilla.components.feature.webnotifications.WebNotificationFeature
|
||||||
import mozilla.components.lib.dataprotect.SecureAbove22Preferences
|
import mozilla.components.lib.dataprotect.SecureAbove22Preferences
|
||||||
import mozilla.components.lib.dataprotect.generateEncryptionKey
|
import mozilla.components.lib.dataprotect.generateEncryptionKey
|
||||||
import mozilla.components.service.sync.logins.SyncableLoginsStorage
|
import mozilla.components.service.sync.logins.SyncableLoginsStorage
|
||||||
import mozilla.components.support.base.log.logger.Logger
|
|
||||||
import org.mozilla.fenix.AppRequestInterceptor
|
import org.mozilla.fenix.AppRequestInterceptor
|
||||||
import org.mozilla.fenix.Config
|
import org.mozilla.fenix.Config
|
||||||
import org.mozilla.fenix.FeatureFlags
|
import org.mozilla.fenix.FeatureFlags
|
||||||
|
@ -53,8 +52,6 @@ import java.util.concurrent.TimeUnit
|
||||||
*/
|
*/
|
||||||
@Mockable
|
@Mockable
|
||||||
class Core(private val context: Context) {
|
class Core(private val context: Context) {
|
||||||
private val logger = Logger("Core")
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The browser engine component initialized based on the build
|
* The browser engine component initialized based on the build
|
||||||
* configuration (see build variants).
|
* configuration (see build variants).
|
||||||
|
@ -192,18 +189,9 @@ class Core(private val context: Context) {
|
||||||
// Use these for startup-path code, where we don't want to do any work that's not strictly necessary.
|
// Use these for startup-path code, where we don't want to do any work that's not strictly necessary.
|
||||||
// For example, this is how the GeckoEngine delegates (history, logins) are configured.
|
// For example, this is how the GeckoEngine delegates (history, logins) are configured.
|
||||||
// We can fully initialize GeckoEngine without initialized our storage.
|
// We can fully initialize GeckoEngine without initialized our storage.
|
||||||
val lazyHistoryStorage = lazy {
|
val lazyHistoryStorage = lazy { PlacesHistoryStorage(context) }
|
||||||
logger.info("Initializing history storage")
|
val lazyBookmarksStorage = lazy { PlacesBookmarksStorage(context) }
|
||||||
PlacesHistoryStorage(context)
|
val lazyPasswordsStorage = lazy { SyncableLoginsStorage(context, passwordsEncryptionKey) }
|
||||||
}
|
|
||||||
val lazyBookmarksStorage = lazy {
|
|
||||||
logger.info("Initializing bookmarks storage")
|
|
||||||
PlacesBookmarksStorage(context)
|
|
||||||
}
|
|
||||||
val lazyPasswordsStorage = lazy {
|
|
||||||
logger.info("Initializing logins storage")
|
|
||||||
SyncableLoginsStorage(context, passwordsEncryptionKey)
|
|
||||||
}
|
|
||||||
|
|
||||||
// For most other application code (non-startup), these wrappers are perfectly fine and more ergonomic.
|
// For most other application code (non-startup), these wrappers are perfectly fine and more ergonomic.
|
||||||
val historyStorage by lazy { lazyHistoryStorage.value }
|
val historyStorage by lazy { lazyHistoryStorage.value }
|
||||||
|
|
Loading…
Reference in New Issue