Пример #1
0
 private void Clear(DeltaWindowEntry ent)
 {
     if (ent.index != null)
     {
         loaded -= ent.index.GetIndexSize();
     }
     else
     {
         if (res.buffer != null)
         {
             loaded -= ent.buffer.Length;
         }
     }
     ent.Set(null);
 }
Пример #2
0
 /// <exception cref="System.IO.IOException"></exception>
 internal virtual void Search(ProgressMonitor monitor, ObjectToPack[] toSearch, int
                              off, int cnt)
 {
     try
     {
         for (int end = off + cnt; off < end; off++)
         {
             res = window[resSlot];
             if (0 < maxMemory)
             {
                 Clear(res);
                 int  tail = Next(resSlot);
                 long need = EstimateSize(toSearch[off]);
                 while (maxMemory < loaded + need && tail != resSlot)
                 {
                     Clear(window[tail]);
                     tail = Next(tail);
                 }
             }
             res.Set(toSearch[off]);
             if ([email protected]())
             {
                 // We don't actually want to make a delta for
                 // them, just need to push them into the window
                 // so they can be read by other objects.
                 //
                 KeepInWindow();
             }
             else
             {
                 // Search for a delta for the current window slot.
                 //
                 monitor.Update(1);
                 Search();
             }
         }
     }
     finally
     {
         if (deflater != null)
         {
             deflater.Finish();
         }
     }
 }
Пример #3
0
 private void Clear(DeltaWindowEntry ent)
 {
     if (ent.index != null)
     {
         loaded -= ent.index.GetIndexSize();
     }
     else
     {
         if (res.buffer != null)
         {
             loaded -= ent.buffer.Length;
         }
     }
     ent.Set(null);
 }
Пример #4
0
        /// <exception cref="System.IO.IOException"></exception>
        internal virtual void Search(ProgressMonitor monitor, ObjectToPack[] toSearch, int
			 off, int cnt)
        {
            try
            {
                for (int end = off + cnt; off < end; off++)
                {
                    res = window[resSlot];
                    if (0 < maxMemory)
                    {
                        Clear(res);
                        int tail = Next(resSlot);
                        long need = EstimateSize(toSearch[off]);
                        while (maxMemory < loaded + need && tail != resSlot)
                        {
                            Clear(window[tail]);
                            tail = Next(tail);
                        }
                    }
                    res.Set(toSearch[off]);
                    if ([email protected]())
                    {
                        // We don't actually want to make a delta for
                        // them, just need to push them into the window
                        // so they can be read by other objects.
                        //
                        KeepInWindow();
                    }
                    else
                    {
                        // Search for a delta for the current window slot.
                        //
                        monitor.Update(1);
                        Search();
                    }
                }
            }
            finally
            {
                if (deflater != null)
                {
                    deflater.Finish();
                }
            }
        }