Beispiel #1
0
        /// <summary>
        /// Inherit modified ranges from another buffer.
        /// </summary>
        /// <param name="from">The buffer to inherit from</param>
        public void InheritModifiedRanges(Buffer from)
        {
            if (from._modifiedRanges != null)
            {
                if (from._syncActionRegistered && !_syncActionRegistered)
                {
                    _context.RegisterSyncAction(SyncAction);
                    _syncActionRegistered = true;
                }

                Action <ulong, ulong> registerRangeAction = (ulong address, ulong size) =>
                {
                    if (_useGranular)
                    {
                        _memoryTrackingGranular.RegisterAction(address, size, _externalFlushDelegate);
                    }
                    else
                    {
                        _memoryTracking.RegisterAction(_externalFlushDelegate);
                    }
                };

                if (_modifiedRanges == null)
                {
                    _modifiedRanges = from._modifiedRanges;
                    _modifiedRanges.ReregisterRanges(registerRangeAction);

                    from._modifiedRanges = null;
                }
                else
                {
                    _modifiedRanges.InheritRanges(from._modifiedRanges, registerRangeAction);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Inherit modified ranges from another buffer.
        /// </summary>
        /// <param name="from">The buffer to inherit from</param>
        public void InheritModifiedRanges(Buffer from)
        {
            if (from._modifiedRanges != null)
            {
                if (from._syncActionRegistered && !_syncActionRegistered)
                {
                    _context.RegisterSyncAction(SyncAction);
                    _syncActionRegistered = true;
                }

                EnsureRangeList();
                _modifiedRanges.InheritRanges(from._modifiedRanges, (ulong address, ulong size) =>
                {
                    if (_useGranular)
                    {
                        _memoryTrackingGranular.RegisterAction(address, size, _externalFlushDelegate);
                    }
                    else
                    {
                        _memoryTracking.RegisterAction(_externalFlushDelegate);
                    }
                });
            }
        }