Exemplo n.º 1
0
 internal void AddPointer(IXmlDataVirtualNode pointer)
 {
     Debug.Assert(_pointers.ContainsValue(pointer) == false);
     lock (_pointers)
     {
         _countAddPointer++;
         if (_countAddPointer >= 5)
         {   // 5 is choosed to be small enough to not affect perf, but high enough so we will not scan all the time
             ArrayList al = new ArrayList();
             foreach (DictionaryEntry entry in _pointers)
             {
                 IXmlDataVirtualNode temp = (IXmlDataVirtualNode)(entry.Value);
                 Debug.Assert(temp != null);
                 if (!temp.IsInUse())
                     al.Add(temp);
             }
             for (int i = 0; i < al.Count; i++)
             {
                 _pointers.Remove(al[i]);
             }
             _countAddPointer = 0;
         }
         _pointers[pointer] = pointer;
     }
 }
        internal void AssertPointerPresent( IXmlDataVirtualNode pointer ) {
#if DEBUG
                object val = pointers[pointer];
                if ( val != ( object ) pointer )
                    Debug.Assert( false );
#endif
        }