// Token: 0x060076E5 RID: 30437 RVA: 0x0021F950 File Offset: 0x0021DB50 internal bool Purge() { ArrayList arrayList = new ArrayList(); foreach (object obj in this) { DictionaryEntry dictionaryEntry = (DictionaryEntry)obj; WeakRefKey weakRefKey = (WeakRefKey)dictionaryEntry.Key; if (weakRefKey.Target == null) { ViewRecord viewRecord = (ViewRecord)dictionaryEntry.Value; CollectionView collectionView = viewRecord.View as CollectionView; if (collectionView != null) { if (!collectionView.IsInUse) { collectionView.DetachFromSourceCollection(); arrayList.Add(weakRefKey); } } else { arrayList.Add(weakRefKey); } } } for (int i = 0; i < arrayList.Count; i++) { base.Remove(arrayList[i]); } return(arrayList.Count > 0 || base.Count == 0); }
// remove entries whose key (CVS) has been GC'd, and whose collection // view is no longer in use. Return true if anything got removed, // or if there are no entries left internal bool Purge() { ArrayList al = new ArrayList(); foreach (DictionaryEntry de in this) { WeakRefKey key = (WeakRefKey)de.Key; if (key.Target == null) { ViewRecord vr = (ViewRecord)de.Value; CollectionView cv = vr.View as CollectionView; if (cv != null) { if (!cv.IsInUse) { // tell the corresponding CollectionView to detach cv.DetachFromSourceCollection(); al.Add(key); // mark this entry for removal } } else { al.Add(key); } } } for (int k = 0; k < al.Count; ++k) { this.Remove(al[k]); } return(al.Count > 0 || this.Count == 0); }
// Token: 0x17001C4A RID: 7242 public CollectionRecord this[object o] { get { WeakRefKey weakRefKey = new WeakRefKey(o); return((CollectionRecord) base[weakRefKey]); } }
// Token: 0x06007700 RID: 30464 RVA: 0x002200BC File Offset: 0x0021E2BC internal bool Purge() { int count = this._inactiveViewTables.Count; if (count > 0) { ViewTable[] array = new ViewTable[count]; this._inactiveViewTables.Keys.CopyTo(array, 0); for (int i = 0; i < count; i++) { ViewTable key = array[i]; int num = (int)this._inactiveViewTables[key]; if (--num > 0) { this._inactiveViewTables[key] = num; } else { this._inactiveViewTables.Remove(key); } } } ArrayList arrayList = new ArrayList(); bool flag = false; foreach (object obj in this) { DictionaryEntry dictionaryEntry = (DictionaryEntry)obj; WeakRefKey weakRefKey = (WeakRefKey)dictionaryEntry.Key; CollectionRecord collectionRecord = (CollectionRecord)dictionaryEntry.Value; if (weakRefKey.Target == null || !collectionRecord.IsAlive) { arrayList.Add(weakRefKey); } else { ViewTable viewTable = collectionRecord.ViewTable; if (viewTable != null && viewTable.Purge()) { flag = true; if (viewTable.Count == 0) { collectionRecord.ViewTable = null; if (!collectionRecord.IsAlive) { arrayList.Add(weakRefKey); } } } } } for (int j = 0; j < arrayList.Count; j++) { base.Remove(arrayList[j]); } return(arrayList.Count > 0 || flag); }
//------------------------------------------------------ // // Public Properties // //------------------------------------------------------ public new CollectionRecord this[object o] { get { // look up the entry for o WeakRefKey key = new WeakRefKey(o); CollectionRecord cr = (CollectionRecord) base[key]; return(cr); } }
// Token: 0x060076E0 RID: 30432 RVA: 0x0021F8A8 File Offset: 0x0021DAA8 public override bool Equals(object o) { if (!(o is WeakRefKey)) { return(false); } WeakRefKey weakRefKey = (WeakRefKey)o; object target = this.Target; object target2 = weakRefKey.Target; if (target != null && target2 != null) { return(target == target2); } return(this._weakRef == weakRefKey._weakRef); }
public override bool Equals(object o) { if (o is WeakRefKey) { WeakRefKey ck = (WeakRefKey)o; object c1 = Target; object c2 = ck.Target; if (c1 != null && c2 != null) { return(c1 == c2); } else { return(_weakRef == ck._weakRef); } } else { return(false); } }
//------------------------------------------------------ // // Public Properties // //----------------------------------------------------- public new ViewTable this[object o] { get { // look up the entry for o WeakRefKey key = new WeakRefKey(o); WeakReference wr = (WeakReference)base[key]; if (wr != null) { // we have an entry for o, get its ViewTable ViewTable vt = (ViewTable)wr.Target; // if the ViewTable has been GC'd, remove the entry if (vt == null) Remove(key); return vt; } else { // no entry for o return null; } } }
// purge the table of dead entries internal bool Purge() { // decrease the expiration dates of ViewTables on the inactive // list, and remove the ones that have expired. int n = _inactiveViewTables.Count; if (n > 0) { ViewTable[] keys = new ViewTable[n]; _inactiveViewTables.Keys.CopyTo(keys, 0); for (int i = 0; i < n; ++i) { ViewTable vt = keys[i]; int expirationDate = (int)_inactiveViewTables[vt]; if (--expirationDate > 0) { _inactiveViewTables[vt] = expirationDate; } else { _inactiveViewTables.Remove(vt); } } } // purge the table of entries whose collection has been GC'd. ArrayList al = new ArrayList(); bool foundViewTableDirt = false; foreach (DictionaryEntry de in this) { WeakRefKey key = (WeakRefKey)de.Key; CollectionRecord cr = (CollectionRecord)de.Value; if (key.Target == null || !cr.IsAlive) { al.Add(key); } else { // also purge ViewTable entries whose key (CVS) has been GC'd ViewTable vt = cr.ViewTable; if (vt != null && vt.Purge()) { foundViewTableDirt = true; if (vt.Count == 0) { // remove the ViewTable (it has no views remaining) cr.ViewTable = null; if (!cr.IsAlive) { al.Add(key); } } } } } for (int k = 0; k < al.Count; ++k) { this.Remove(al[k]); } return(al.Count > 0 || foundViewTableDirt); }
//------------------------------------------------------ // // Public Properties // //------------------------------------------------------ public new CollectionRecord this[object o] { get { // look up the entry for o WeakRefKey key = new WeakRefKey(o); CollectionRecord cr = (CollectionRecord)base[key]; return cr; } }