mirror of
https://gitflic.ru/project/openide/openide.git
synced 2025-12-14 18:05:27 +07:00
Clean-up withKernel usages
For RPC requests, it's not necessary to call `withKernel` - API can be resolved without that. To avoid context switching and to simplify the code I remove `withKernel` from API calls. GitOrigin-RevId: 9514260da113583e36f2979b0543310d27cd3db4
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a5ab71839e
commit
6f9ba26707
@@ -3,7 +3,6 @@ package com.intellij.platform.debugger.impl.frontend.evaluate.quick
|
||||
|
||||
import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.platform.kernel.withKernel
|
||||
import com.intellij.xdebugger.XDebuggerBundle
|
||||
import com.intellij.xdebugger.XSourcePosition
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEvaluator
|
||||
@@ -21,19 +20,17 @@ private val LOG = logger<FrontendXDebuggerEvaluator>()
|
||||
internal class FrontendXDebuggerEvaluator(private val project: Project, private val scope: CoroutineScope, private val evaluatorId: XDebuggerEvaluatorId) : XDebuggerEvaluator() {
|
||||
override fun evaluate(expression: String, callback: XEvaluationCallback, expressionPosition: XSourcePosition?) {
|
||||
scope.launch(Dispatchers.EDT) {
|
||||
withKernel {
|
||||
try {
|
||||
val evaluation = XDebuggerEvaluatorApi.getInstance().evaluate(evaluatorId, expression).await()
|
||||
when (evaluation) {
|
||||
is XEvaluationResult.Evaluated -> callback.evaluated(FrontendXValue(project, evaluation.valueId))
|
||||
is XEvaluationResult.EvaluationError -> callback.errorOccurred(evaluation.errorMessage)
|
||||
}
|
||||
}
|
||||
catch (e: Exception) {
|
||||
callback.errorOccurred(e.message ?: XDebuggerBundle.message("xdebugger.evaluate.stack.frame.has.not.evaluator"))
|
||||
LOG.error(e)
|
||||
try {
|
||||
val evaluation = XDebuggerEvaluatorApi.getInstance().evaluate(evaluatorId, expression).await()
|
||||
when (evaluation) {
|
||||
is XEvaluationResult.Evaluated -> callback.evaluated(FrontendXValue(project, evaluation.valueId))
|
||||
is XEvaluationResult.EvaluationError -> callback.errorOccurred(evaluation.errorMessage)
|
||||
}
|
||||
}
|
||||
catch (e: Exception) {
|
||||
callback.errorOccurred(e.message ?: XDebuggerBundle.message("xdebugger.evaluate.stack.frame.has.not.evaluator"))
|
||||
LOG.error(e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import com.intellij.openapi.application.EDT
|
||||
import com.intellij.openapi.components.Service
|
||||
import com.intellij.openapi.components.service
|
||||
import com.intellij.openapi.project.Project
|
||||
import com.intellij.platform.kernel.withKernel
|
||||
import com.intellij.platform.util.coroutines.childScope
|
||||
import com.intellij.util.ConcurrencyUtil
|
||||
import com.intellij.xdebugger.Obsolescent
|
||||
@@ -68,9 +67,7 @@ private fun Obsolescent.childCoroutineScope(name: String): CoroutineScope {
|
||||
private class FrontendXValueDisposer(project: Project, val cs: CoroutineScope) {
|
||||
fun dispose(xValueId: XValueId) {
|
||||
cs.launch(Dispatchers.IO) {
|
||||
withKernel {
|
||||
XDebuggerEvaluatorApi.getInstance().disposeXValue(xValueId)
|
||||
}
|
||||
XDebuggerEvaluatorApi.getInstance().disposeXValue(xValueId)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,6 @@ import com.intellij.platform.debugger.impl.frontend.evaluate.quick.common.Remote
|
||||
import com.intellij.frontend.FrontendApplicationInfo
|
||||
import com.intellij.frontend.FrontendType
|
||||
import com.intellij.platform.debugger.impl.frontend.FrontendXDebuggerManager
|
||||
import com.intellij.platform.kernel.withKernel
|
||||
import com.intellij.platform.project.projectId
|
||||
import com.intellij.xdebugger.XDebuggerManager
|
||||
import com.intellij.xdebugger.evaluation.XDebuggerEditorsProvider
|
||||
@@ -52,10 +51,8 @@ internal class XQuickEvaluateHandler : QuickEvaluateHandler() {
|
||||
val projectId = project.projectId()
|
||||
val editorId = editor.editorId()
|
||||
val expressionInfoDeferred = documentCoroutineScope.async(Dispatchers.IO) {
|
||||
withKernel {
|
||||
val remoteApi = XDebuggerValueLookupHintsRemoteApi.getInstance()
|
||||
remoteApi.getExpressionInfo(projectId, editorId, offset, type)
|
||||
}
|
||||
val remoteApi = XDebuggerValueLookupHintsRemoteApi.getInstance()
|
||||
remoteApi.getExpressionInfo(projectId, editorId, offset, type)
|
||||
}
|
||||
val hintDeferred: Deferred<AbstractValueHint?> = documentCoroutineScope.async(Dispatchers.IO) {
|
||||
val expressionInfo = expressionInfoDeferred.await()
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package com.intellij.xdebugger.impl.rpc
|
||||
|
||||
import com.intellij.openapi.util.NlsContexts
|
||||
import com.intellij.platform.kernel.withKernel
|
||||
import com.intellij.platform.rpc.RemoteApiProviderService
|
||||
import com.jetbrains.rhizomedb.EID
|
||||
import fleet.rpc.RemoteApi
|
||||
@@ -27,9 +26,7 @@ interface XDebuggerEvaluatorApi : RemoteApi<Unit> {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
suspend fun getInstance(): XDebuggerEvaluatorApi {
|
||||
return withKernel {
|
||||
RemoteApiProviderService.resolve(remoteApiDescriptor<XDebuggerEvaluatorApi>())
|
||||
}
|
||||
return RemoteApiProviderService.resolve(remoteApiDescriptor<XDebuggerEvaluatorApi>())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
package com.intellij.xdebugger.impl.rpc
|
||||
|
||||
import com.intellij.openapi.editor.impl.EditorId
|
||||
import com.intellij.platform.kernel.withKernel
|
||||
import com.intellij.platform.project.ProjectId
|
||||
import com.intellij.platform.rpc.RemoteApiProviderService
|
||||
import com.intellij.xdebugger.evaluation.ExpressionInfo
|
||||
@@ -31,9 +30,7 @@ interface XDebuggerValueLookupHintsRemoteApi : RemoteApi<Unit> {
|
||||
companion object {
|
||||
@JvmStatic
|
||||
suspend fun getInstance(): XDebuggerValueLookupHintsRemoteApi {
|
||||
return withKernel {
|
||||
RemoteApiProviderService.resolve(remoteApiDescriptor<XDebuggerValueLookupHintsRemoteApi>())
|
||||
}
|
||||
return RemoteApiProviderService.resolve(remoteApiDescriptor<XDebuggerValueLookupHintsRemoteApi>())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user