private bool MakeSpace(SlotType neededSlot, ObjectContext[] doNotEvict)
{
ObjectContext entityToEvict = ContextManager.GetBestEvictionCandidate(neededSlot, doNotEvict);
if (entityToEvict == null)
{
return false;
}
// Candidate is the entity that we need to evict. Save it, and then update our internal database.
Context b = Tpm.ContextSave(entityToEvict.TheTpmHandle);
entityToEvict.Context = b;
// Non-session objects evict on their own. Transient objects need to be evicted explictly.
// TODO: Manage the saved-context array.
if (neededSlot != SlotType.SessionSlot)
{
Tpm.FlushContext(entityToEvict.TheTpmHandle);
}
entityToEvict.TheTpmHandle = null;
entityToEvict.Loaded = false;
return true;
}