Commit b8fe17e9 authored by Dmitry Batkovich's avatar Dmitry Batkovich
Browse files

file based indices: remove redundant isContentPhysical check (because it's...

file based indices: remove redundant isContentPhysical check (because it's equivalent to in memory mode flag)
parent 07a38357
Showing with 2 additions and 15 deletions
+2 -15
......@@ -1640,8 +1640,6 @@ public class FileBasedIndexImpl extends FileBasedIndex implements BaseComponent,
fc.putUserData(IndexingDataKeys.PROJECT, project);
}
static final Key<Boolean> ourPhysicalContentKey = Key.create("physical.content.flag");
private void updateSingleIndex(@NotNull ID<?, ?> indexId, VirtualFile file, final int inputId, @Nullable FileContent currentFC) {
if (!RebuildStatus.isOk(indexId) && !myIsUnitTestMode) {
return; // the index is scheduled for rebuild, no need to update
......@@ -1652,9 +1650,6 @@ public class FileBasedIndexImpl extends FileBasedIndex implements BaseComponent,
assert index != null;
boolean hasContent = currentFC != null;
if (hasContent && currentFC.getUserData(ourPhysicalContentKey) == null) {
currentFC.putUserData(ourPhysicalContentKey, Boolean.TRUE);
}
if (ourIndexedFile.get() != null) throw new AssertionError("Reentrant indexing");
ourIndexedFile.set(file);
......
......@@ -7,7 +7,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.TransactionGuard;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.util.UserDataHolder;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.impl.cache.impl.id.IdIndex;
import com.intellij.psi.search.GlobalSearchScope;
......@@ -71,8 +70,7 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
protected UpdateData<Key, Value> calculateUpdateData(int inputId, @Nullable Input content) {
Map<Key, Value> data;
int hashId;
final boolean isContentPhysical = isContentPhysical(content);
if (mySnapshotInputMappings != null && isContentPhysical) {
if (mySnapshotInputMappings != null && !myInMemoryMode.get()) {
final SnapshotInputMappings.Snapshot<Key, Value> snapshot = mySnapshotInputMappings.readPersistentDataOrMap(content);
data = snapshot.getData();
hashId = snapshot.getHashId();
......@@ -82,7 +80,7 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
hashId = 0;
}
return createUpdateData(data, () -> {
if (mySnapshotInputMappings != null && isContentPhysical) {
if (mySnapshotInputMappings != null && !myInMemoryMode.get()) {
return new MapInputDataDiffBuilder<>(inputId, mySnapshotInputMappings.readInputKeys(inputId));
}
if (myInMemoryMode.get()) {
......@@ -311,12 +309,6 @@ public class VfsAwareMapReduceIndex<Key, Value, Input> extends MapReduceIndex<Ke
}
}
private boolean isContentPhysical(Input content) {
return content == null ||
(content instanceof UserDataHolder &&
FileBasedIndexImpl.ourPhysicalContentKey.get((UserDataHolder)content, Boolean.FALSE));
}
private void installMemoryModeListener() {
IndexStorage<Key, Value> storage = getStorage();
if (storage instanceof MemoryIndexStorage) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment