mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
cache source positions to speedup frame loading when stepping
This commit is contained in:
@@ -36,10 +36,7 @@ import com.sun.jdi.request.ClassPrepareRequest;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
|
||||
public class CompoundPositionManager extends PositionManagerEx implements MultiRequestPositionManager{
|
||||
private static final Logger LOG = Logger.getInstance(CompoundPositionManager.class);
|
||||
@@ -57,9 +54,10 @@ public class CompoundPositionManager extends PositionManagerEx implements MultiR
|
||||
public void appendPositionManager(PositionManager manager) {
|
||||
myPositionManagers.remove(manager);
|
||||
myPositionManagers.add(0, manager);
|
||||
mySourcePositionCache.clear();
|
||||
}
|
||||
|
||||
private final Cache<Location, SourcePosition> mySourcePositionCache = new Cache<>();
|
||||
private final Map<Location, SourcePosition> mySourcePositionCache = new WeakHashMap<>();
|
||||
|
||||
private interface Processor<T> {
|
||||
T process(PositionManager positionManager) throws NoDataException;
|
||||
@@ -196,21 +194,4 @@ public class CompoundPositionManager extends PositionManagerEx implements MultiR
|
||||
}
|
||||
return ThreeState.UNSURE;
|
||||
}
|
||||
|
||||
private static class Cache<K,V> {
|
||||
private K myKey;
|
||||
private V myValue;
|
||||
|
||||
public V get(@NotNull K key) {
|
||||
if (key.equals(myKey)) {
|
||||
return myValue;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void put(@NotNull K key, V value) {
|
||||
myKey = key;
|
||||
myValue = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user