From 6348100bcace4802ce32fceff45b84e9b1883135 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 31 Jul 2023 22:28:06 +0300 Subject: [PATCH] init LafManager before calling application starter GitOrigin-RevId: 9c3340023b0ee7fb9cdc1c013adace8e671b950e --- .../com/intellij/ide/bootstrap/appPreInit.kt | 36 ++++++++++--------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/bootstrap/appPreInit.kt b/platform/platform-impl/src/com/intellij/ide/bootstrap/appPreInit.kt index e3f0168024c8..e5547ee53713 100644 --- a/platform/platform-impl/src/com/intellij/ide/bootstrap/appPreInit.kt +++ b/platform/platform-impl/src/com/intellij/ide/bootstrap/appPreInit.kt @@ -140,11 +140,11 @@ private suspend fun initServiceContainer(app: ApplicationImpl, pluginSetDeferred } private suspend fun preInitApp(app: ApplicationImpl, - asyncScope: CoroutineScope, - log: Logger, - initLafJob: Job, - appRegisteredJob: Job, - euaTaskDeferred: Deferred<(suspend () -> Boolean)?>?) { + asyncScope: CoroutineScope, + log: Logger, + initLafJob: Job, + appRegisteredJob: Job, + euaTaskDeferred: Deferred<(suspend () -> Boolean)?>?) { coroutineScope { launch(CoroutineName("critical services preloading")) { preloadCriticalServices(app = app, asyncScope = asyncScope, appRegistered = appRegisteredJob, initLafJob = initLafJob) @@ -176,18 +176,8 @@ private suspend fun preInitApp(app: ApplicationImpl, euaTaskDeferred?.await()?.invoke() - asyncScope.launch { - if (!app.isHeadlessEnvironment) { - launch(CoroutineName("icons preloading") + Dispatchers.IO) { - AsyncProcessIcon.createBig(this) - AsyncProcessIcon(this) - AnimatedIcon.Blinking(AllIcons.Ide.FatalError) - AnimatedIcon.FS() - } - } - + launch { coroutineScope { - loadIconMapping?.join() launch { // used by LafManager app.serviceAsync() @@ -197,16 +187,28 @@ private suspend fun preInitApp(app: ApplicationImpl, } } + loadIconMapping?.join() + span("laf initialization", RawSwingDispatcher) { app.serviceAsync() } + if (!app.isHeadlessEnvironment) { // preload only when LafManager is ready - launch { + asyncScope.launch { app.serviceAsync() } } } + + if (!app.isHeadlessEnvironment) { + asyncScope.launch(CoroutineName("icons preloading") + Dispatchers.IO) { + AsyncProcessIcon.createBig(this) + AsyncProcessIcon(this) + AnimatedIcon.Blinking(AllIcons.Ide.FatalError) + AnimatedIcon.FS() + } + } } }