save storage files in pooled thread - part1: move project name saving from doSave to beforeSaveComponents because it is more logical place

No need to apply planned optimization for project name saving because it is changed very rarely - better to make code more simple. Later, when feature will be fully implemented, maybe it will be also optimized if need
This commit is contained in:
Vladimir Krivosheev
2019-01-04 18:06:24 +01:00
parent 5a7a1e7634
commit d6a64f2eeb
3 changed files with 9 additions and 4 deletions
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.configurationStore
import com.intellij.configurationStore.schemeManager.SchemeManagerFactoryBase
@@ -16,7 +16,7 @@ abstract class ComponentStoreWithExtraComponents : ComponentStoreImpl() {
super.initComponent(component, isService)
}
final override fun beforeSaveComponents(errors: MutableList<Throwable>) {
override fun beforeSaveComponents(errors: MutableList<Throwable>) {
// component state uses scheme manager in an ipr project, so, we must save it before
val isIprProject = project?.let { !it.isDirectoryBased } ?: false
if (isIprProject) {
@@ -322,7 +322,7 @@ private open class ProjectStoreImpl(project: Project, private val pathMacroManag
}
}
override fun doSave(saveSession: SaveExecutor, readonlyFiles: MutableList<SaveSessionAndFile>, errors: MutableList<Throwable>) {
final override fun beforeSaveComponents(errors: MutableList<Throwable>) {
try {
saveProjectName()
}
@@ -330,6 +330,10 @@ private open class ProjectStoreImpl(project: Project, private val pathMacroManag
LOG.error("Unable to store project name", e)
}
super.beforeSaveComponents(errors)
}
override fun doSave(saveSession: SaveExecutor, readonlyFiles: MutableList<SaveSessionAndFile>, errors: MutableList<Throwable>) {
beforeSave(readonlyFiles)
super.doSave(saveSession, readonlyFiles, errors)
@@ -1,4 +1,4 @@
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.configurationStore
import com.intellij.openapi.Disposable
@@ -328,6 +328,7 @@ open class StateStorageManagerImpl(private val rootTagName: String,
open val isExternalSystemStorageEnabled: Boolean
get() = false
// function must be pure and do not use anything outside of passed arguments
protected open fun beforeElementSaved(elements: MutableList<Element>, rootAttributes: MutableMap<String, String>) {
}