Add caching by project to decompiled data
This commit is contained in:
@@ -54,7 +54,9 @@ public class JetDecompiledData {
|
|||||||
@NotNull
|
@NotNull
|
||||||
public static JetDecompiledData getDecompiledData(@NotNull VirtualFile virtualFile, @NotNull Project project) {
|
public static JetDecompiledData getDecompiledData(@NotNull VirtualFile virtualFile, @NotNull Project project) {
|
||||||
synchronized (LOCK) {
|
synchronized (LOCK) {
|
||||||
if (virtualFile.getUserData(USER_DATA_KEY) == null) {
|
JetDecompiledData cachedData = virtualFile.getUserData(USER_DATA_KEY);
|
||||||
|
//TODO: use cached value that keeps modification tracking for this virtual file
|
||||||
|
if (cachedData == null || cachedData.getProject() != project) {
|
||||||
virtualFile.putUserData(USER_DATA_KEY, DecompiledDataFactory.createDecompiledData(virtualFile, project));
|
virtualFile.putUserData(USER_DATA_KEY, DecompiledDataFactory.createDecompiledData(virtualFile, project));
|
||||||
}
|
}
|
||||||
JetDecompiledData decompiledData = virtualFile.getUserData(USER_DATA_KEY);
|
JetDecompiledData decompiledData = virtualFile.getUserData(USER_DATA_KEY);
|
||||||
@@ -89,4 +91,9 @@ public class JetDecompiledData {
|
|||||||
public JetFile getFile() {
|
public JetFile getFile() {
|
||||||
return file;
|
return file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
public Project getProject() {
|
||||||
|
return file.getProject();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user