From ad645bf141f6a035044af5d85e606874cd0efc67 Mon Sep 17 00:00:00 2001 From: Egor Ushakov Date: Fri, 20 Dec 2024 19:18:57 +0100 Subject: [PATCH] [debugger] do not recompute location - use already computed value GitOrigin-RevId: d62d86215d716db5a31d5fa337c825c91e9b4b99 --- .../ui/impl/watch/StackFrameDescriptorImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java index 4cfab4a60290..00fb8f596b2e 100644 --- a/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/ui/impl/watch/StackFrameDescriptorImpl.java @@ -82,9 +82,8 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac } } - private static CompletableFuture getSourcePositionAsync(@NotNull StackFrameProxyImpl frame) { + private static CompletableFuture getSourcePositionAsync(@NotNull Location location, @NotNull StackFrameProxyImpl frame) { try { - Location location = frame.location(); CompoundPositionManager positionManager = frame.getVirtualMachine().getDebugProcess().getPositionManager(); return positionManager.getSourcePositionFuture(location); } @@ -95,9 +94,12 @@ public class StackFrameDescriptorImpl extends NodeDescriptorImpl implements Stac public static CompletableFuture createAsync(@NotNull StackFrameProxyImpl frame, @NotNull MethodsTracker tracker) { - return frame.locationAsync() + CompletableFuture locationAsync = frame.locationAsync(); + CompletableFuture positionAsync = + locationAsync.thenCompose(location -> DebuggerUtilsAsync.reschedule(getSourcePositionAsync(location, frame))); + return locationAsync .thenCompose(DebuggerUtilsAsync::method) - .thenCombine(DebuggerUtilsAsync.reschedule(getSourcePositionAsync(frame)), (method, position) -> { + .thenCombine(positionAsync, (method, position) -> { DebuggerManagerThreadImpl.assertIsManagerThread(); return new StackFrameDescriptorImpl(frame, true, method, tracker, position); })