mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[rd][debugger] IJPL-177087 Minor improvements in BackendXExecutionStackApi
GitOrigin-RevId: afb56463d11d204b9168bf3250264a99b0260a18
This commit is contained in:
committed by
intellij-monorepo-bot
parent
22f6d6723d
commit
d6a649e04b
+7
-6
@@ -34,19 +34,23 @@ internal class BackendXExecutionStackApi : XExecutionStackApi {
|
||||
override suspend fun computeStackFrames(executionStackId: XExecutionStackId, firstFrameIndex: Int): Flow<XStackFramesEvent> {
|
||||
val executionStackEntity = debuggerEntity<XExecutionStackEntity>(executionStackId.id) ?: return emptyFlow()
|
||||
return channelFlow {
|
||||
val channel = Channel<Deferred<XStackFramesEvent>?>(capacity = Channel.UNLIMITED)
|
||||
val channel = Channel<Deferred<XStackFramesEvent>>(capacity = Channel.UNLIMITED)
|
||||
|
||||
launch {
|
||||
for (event in channel) {
|
||||
if (event == null) {
|
||||
val event = event.await()
|
||||
this@channelFlow.send(event)
|
||||
if (event is XStackFramesEvent.ErrorOccurred || event is XStackFramesEvent.XNewStackFrames && event.last) {
|
||||
channel.close()
|
||||
this@channelFlow.close()
|
||||
break
|
||||
}
|
||||
this@channelFlow.send(event.await())
|
||||
}
|
||||
}
|
||||
|
||||
// TODO[IJPL-177087]: executionStackEntity gets removed from DB because new ones come to the flow for some reason,
|
||||
// so addStackFrames may end abruptly, with not all stack frames shown.
|
||||
// Investigate whether it's really needed
|
||||
withEntities(executionStackEntity) {
|
||||
val executionStack = executionStackEntity.obj
|
||||
executionStack.computeStackFrames(firstFrameIndex, object : XExecutionStack.XStackFrameContainer {
|
||||
@@ -69,9 +73,6 @@ internal class BackendXExecutionStackApi : XExecutionStackApi {
|
||||
XStackFramesEvent.XNewStackFrames(stacks, last)
|
||||
}
|
||||
})
|
||||
if (last) {
|
||||
channel.trySend(null)
|
||||
}
|
||||
}
|
||||
|
||||
override fun errorOccurred(errorMessage: @NlsContexts.DialogMessage String) {
|
||||
|
||||
Reference in New Issue
Block a user