mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
IJPL-148837 PersistentStateComponentWithModificationTracker doesn't help - remove to simplify code
GitOrigin-RevId: 65b91e42f34947843079ed478e176918890a0f3e
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0904aef625
commit
fa9201ab6e
@@ -6,7 +6,7 @@ import com.intellij.ide.file.BatchFileChangeListener
|
||||
import com.intellij.internal.performanceTests.ProjectInitializationDiagnosticService
|
||||
import com.intellij.openapi.Disposable
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.components.PersistentStateComponentWithModificationTracker
|
||||
import com.intellij.openapi.components.PersistentStateComponent
|
||||
import com.intellij.openapi.components.State
|
||||
import com.intellij.openapi.components.Storage
|
||||
import com.intellij.openapi.components.StoragePathMacros.CACHE_FILE
|
||||
@@ -37,7 +37,6 @@ import org.jetbrains.annotations.TestOnly
|
||||
import java.util.*
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.atomic.AtomicReference
|
||||
import java.util.concurrent.atomic.LongAdder
|
||||
import kotlin.streams.asStream
|
||||
|
||||
@ApiStatus.Internal
|
||||
@@ -46,7 +45,7 @@ class AutoImportProjectTracker(
|
||||
private val project: Project
|
||||
) : ExternalSystemProjectTracker,
|
||||
Disposable.Default,
|
||||
PersistentStateComponentWithModificationTracker<AutoImportProjectTracker.State> {
|
||||
PersistentStateComponent<AutoImportProjectTracker.State> {
|
||||
|
||||
private val serviceDisposable: Disposable = this
|
||||
|
||||
@@ -61,10 +60,6 @@ class AutoImportProjectTracker(
|
||||
private val dispatcher = MergingUpdateQueue("AutoImportProjectTracker.dispatcher", 300, true, null, serviceDisposable)
|
||||
private val backgroundExecutor = AppExecutorUtil.createBoundedApplicationPoolExecutor("AutoImportProjectTracker.backgroundExecutor", 1)
|
||||
|
||||
private val stateChangeCounter = LongAdder()
|
||||
|
||||
override fun getStateModificationCount() = stateChangeCounter.sum()
|
||||
|
||||
private fun createProjectChangesListener() =
|
||||
object : ProjectBatchFileChangeListener(project) {
|
||||
override fun batchChangeStarted(activityName: String?) =
|
||||
@@ -174,8 +169,6 @@ class AutoImportProjectTracker(
|
||||
val context = ProjectReloadContext(explicitReload, hasUndefinedModifications, settingsContext)
|
||||
projectData.projectAware.reloadProject(context)
|
||||
}
|
||||
|
||||
stateChangeCounter.increment()
|
||||
}
|
||||
|
||||
private fun updateProjectNotification() {
|
||||
@@ -226,33 +219,26 @@ class AutoImportProjectTracker(
|
||||
parentDisposable.whenDisposed { notificationAware.notificationExpire(projectId) }
|
||||
|
||||
loadState(projectId, projectData)
|
||||
|
||||
stateChangeCounter.increment()
|
||||
}
|
||||
|
||||
override fun activate(id: ExternalSystemProjectId) {
|
||||
val projectData = projectDataMap(id) { get(it) } ?: return
|
||||
projectData.isActivated = true
|
||||
|
||||
stateChangeCounter.increment()
|
||||
}
|
||||
|
||||
override fun remove(id: ExternalSystemProjectId) {
|
||||
val projectData = projectDataMap.remove(id) ?: return
|
||||
Disposer.dispose(projectData.parentDisposable)
|
||||
stateChangeCounter.increment()
|
||||
}
|
||||
|
||||
override fun markDirty(id: ExternalSystemProjectId) {
|
||||
val projectData = projectDataMap(id) { get(it) } ?: return
|
||||
projectData.status.markDirty(currentTime())
|
||||
stateChangeCounter.increment()
|
||||
}
|
||||
|
||||
override fun markDirtyAllProjects() {
|
||||
val modificationTimeStamp = currentTime()
|
||||
projectDataMap.forEach { it.value.status.markDirty(modificationTimeStamp) }
|
||||
stateChangeCounter.increment()
|
||||
}
|
||||
|
||||
private fun projectDataMap(
|
||||
|
||||
Reference in New Issue
Block a user