Stop leaking data in PatchLineCache keys

As in other persisted caches, references to excess data may stick
around longer than we need them. Particularly in the case of the
intraline diff cache, this can be a significant amount of data. Avoid
this by using non-LoadingCaches. Because these loader implementations
are somewhat complex, we need additional factories and args classes.

Change-Id: Ic5a0543f0b70dbeee7dac47bbbd6f4a4fce0815c
This commit is contained in:
Dave Borowitz
2015-08-06 15:57:13 -07:00
committed by Shawn Pearce
parent 9efcff3124
commit fdbb76233c
14 changed files with 172 additions and 159 deletions

View File

@@ -91,7 +91,7 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
private final PatchLineCommentsUtil plcUtil;
private final ChangeEditUtil editUtil;
private Project.NameKey projectKey;
private Project.NameKey project;
private final PatchSet.Id psIdBase;
private final PatchSet.Id psIdNew;
private final AccountDiffPreference diffPrefs;
@@ -150,7 +150,7 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
throw new NoSuchEntityException();
}
}
projectKey = control.getProject().getNameKey();
project = control.getProject().getNameKey();
final PatchList list;
try {
@@ -188,7 +188,7 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
detail = new PatchSetDetail();
detail.setPatchSet(patchSet);
detail.setProject(projectKey);
detail.setProject(project);
detail.setInfo(infoFactory.get(db, patchSet.getId()));
detail.setPatches(patches);
@@ -251,12 +251,12 @@ class PatchSetDetailFactory extends Handler<PatchSetDetail> {
}
}
private PatchListKey keyFor(final Whitespace whitespace) {
return new PatchListKey(projectKey, oldId, newId, whitespace);
private PatchListKey keyFor(Whitespace whitespace) {
return new PatchListKey(oldId, newId, whitespace);
}
private PatchList listFor(PatchListKey key)
throws PatchListNotAvailableException {
return patchListCache.get(key);
return patchListCache.get(key, project);
}
}