mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not hard-retain changed documents (via myUncommitInfos->UncommitInfo.events) to allow even changed documents to gc (part of IJPL-50077 freezing on replace)
GitOrigin-RevId: 48006283b99d61fb71f2a591cb87a534fd52a2df
This commit is contained in:
committed by
intellij-monorepo-bot
parent
0fed93ab4c
commit
cdb4b9a22b
@@ -75,8 +75,7 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen
|
||||
@ApiStatus.Internal
|
||||
protected final Set<Document> myUncommittedDocuments = Collections.newSetFromMap(CollectionFactory.createConcurrentWeakMap());
|
||||
private final Map<Document, Throwable> myUncommittedDocumentTraces = CollectionFactory.createConcurrentWeakMap();
|
||||
private final Map<Document, UncommittedInfo> myUncommittedInfos = new ConcurrentHashMap<>();
|
||||
private /*non-static*/ final Key<UncommittedInfo> FREE_THREADED_UNCOMMITTED_INFO = Key.create("FREE_THREADED_UNCOMMITTED_INFO");
|
||||
private /*non-static*/ final Key<UncommittedInfo> UNCOMMITTED_INFO_KEY = Key.create("UNCOMMITTED_INFO");
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected boolean myStopTrackingDocuments;
|
||||
@@ -903,7 +902,7 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen
|
||||
}
|
||||
|
||||
UncommittedInfo info = getUncommittedInfo(delegate);
|
||||
DocumentWindow answer = info == null ? null : info.myFrozenWindows.get(document);
|
||||
DocumentWindow answer = info == null ? null : info.myFrozenWindows.get(window);
|
||||
if (answer == null) answer = freezeWindow(window);
|
||||
if (info != null) answer = ConcurrencyUtil.cacheOrGet(info.myFrozenWindows, window, answer);
|
||||
return (DocumentEx)answer;
|
||||
@@ -915,17 +914,11 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen
|
||||
}
|
||||
|
||||
private @Nullable UncommittedInfo getUncommittedInfo(@NotNull Document document) {
|
||||
UncommittedInfo info = myUncommittedInfos.get(document);
|
||||
return info != null ? info : document.getUserData(FREE_THREADED_UNCOMMITTED_INFO);
|
||||
return document.getUserData(UNCOMMITTED_INFO_KEY);
|
||||
}
|
||||
|
||||
private void associateUncommittedInfo(Document document, UncommittedInfo info) {
|
||||
if (isEventSystemEnabled(document)) {
|
||||
myUncommittedInfos.put(document, info);
|
||||
}
|
||||
else {
|
||||
document.putUserData(FREE_THREADED_UNCOMMITTED_INFO, info);
|
||||
}
|
||||
document.putUserData(UNCOMMITTED_INFO_KEY, info);
|
||||
}
|
||||
|
||||
protected @NotNull DocumentWindow freezeWindow(@NotNull DocumentWindow document) {
|
||||
@@ -1164,8 +1157,7 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen
|
||||
private @Nullable UncommittedInfo clearUncommittedInfo(@NotNull Document document) {
|
||||
UncommittedInfo info = getUncommittedInfo(document);
|
||||
if (info != null) {
|
||||
myUncommittedInfos.remove(document);
|
||||
document.putUserData(FREE_THREADED_UNCOMMITTED_INFO, null);
|
||||
document.putUserData(UNCOMMITTED_INFO_KEY, null);
|
||||
getSmartPointerManager().updatePointers(document, info.myFrozen, info.myEvents);
|
||||
}
|
||||
return info;
|
||||
@@ -1245,7 +1237,6 @@ public abstract class PsiDocumentManagerBase extends PsiDocumentManager implemen
|
||||
|
||||
@TestOnly
|
||||
public void clearUncommittedDocuments() {
|
||||
myUncommittedInfos.clear();
|
||||
myUncommittedDocuments.clear();
|
||||
myUncommittedDocumentTraces.clear();
|
||||
mySynchronizer.cleanupForNextTest();
|
||||
|
||||
Reference in New Issue
Block a user