mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 12:55:40 +02:00
Bug 297641: Result cache of read-only fragments is not cleared.
This commit is contained in:
parent
cd89d01394
commit
78e2f65d6d
6 changed files with 22 additions and 1 deletions
|
@ -139,4 +139,7 @@ public class EmptyIndexFragment implements IIndexFragment {
|
||||||
public Object putCachedResult(Object key, Object value, boolean replace) {
|
public Object putCachedResult(Object key, Object value, boolean replace) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void clearResultCache() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -614,6 +614,12 @@ public class CIndex implements IIndex {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clearResultCaches() {
|
||||||
|
for (IIndexFragment frag : fFragments) {
|
||||||
|
frag.clearResultCache();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public IIndexFileSet createFileSet() {
|
public IIndexFileSet createFileSet() {
|
||||||
return new IndexFileSet();
|
return new IndexFileSet();
|
||||||
}
|
}
|
||||||
|
|
|
@ -273,4 +273,9 @@ public interface IIndexFragment {
|
||||||
* longer holds a locks.
|
* longer holds a locks.
|
||||||
*/
|
*/
|
||||||
Object getCachedResult(Object key);
|
Object getCachedResult(Object key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the result cache.
|
||||||
|
*/
|
||||||
|
void clearResultCache();
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,6 +122,9 @@ public class WritableCIndex extends CIndex implements IWritableIndex {
|
||||||
|
|
||||||
fIsWriteLocked= false;
|
fIsWriteLocked= false;
|
||||||
fWritableFragment.releaseWriteLock(establishReadlockCount, flush);
|
fWritableFragment.releaseWriteLock(establishReadlockCount, flush);
|
||||||
|
|
||||||
|
// Bug 297641: Result cache of read only providers needs to be cleared.
|
||||||
|
clearResultCaches();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void flush() throws CoreException {
|
public void flush() throws CoreException {
|
||||||
|
|
|
@ -1145,7 +1145,7 @@ public class PDOM extends PlatformObject implements IPDOM {
|
||||||
clearResultCache();
|
clearResultCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void clearResultCache() {
|
public void clearResultCache() {
|
||||||
synchronized (fResultCache) {
|
synchronized (fResultCache) {
|
||||||
fResultCache.clear();
|
fResultCache.clear();
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,4 +274,8 @@ public class PDOMProxy implements IPDOM {
|
||||||
public Object putCachedResult(Object key, Object value, boolean replace) {
|
public Object putCachedResult(Object key, Object value, boolean replace) {
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
public void clearResultCache() {
|
||||||
|
if (fDelegate != null)
|
||||||
|
fDelegate.clearResultCache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue