internal ObjectManager(ISurrogateSelector selector, StreamingContext context, bool checkSecurity, bool isCrossAppDomain) { _objects = new ObjectHolder[DefaultInitialSize]; _selector = selector; _context = context; _isCrossAppDomain = isCrossAppDomain; }
private void AddObjectHolder(ObjectHolder holder) { if ((holder.m_id >= this.m_objects.Length) && (this.m_objects.Length != 0x1000)) { int num = 0x1000; if (holder.m_id < 0x800L) { num = this.m_objects.Length * 2; while ((num <= holder.m_id) && (num < 0x1000)) { num *= 2; } if (num > 0x1000) { num = 0x1000; } } ObjectHolder[] destinationArray = new ObjectHolder[num]; Array.Copy(this.m_objects, destinationArray, this.m_objects.Length); this.m_objects = destinationArray; } int index = (int) (holder.m_id & 0xfffL); ObjectHolder holder2 = this.m_objects[index]; holder.m_next = holder2; this.m_objects[index] = holder; }
[System.Security.SecurityCritical] // auto-generated internal ObjectManager(ISurrogateSelector selector, StreamingContext context, bool checkSecurity, bool isCrossAppDomain) { if (checkSecurity) { CodeAccessPermission.Demand(PermissionType.SecuritySerialization); } m_objects = new ObjectHolder[DefaultInitialSize]; m_selector = selector; m_context = context; m_isCrossAppDomain = isCrossAppDomain; }
internal ObjectManager(ISurrogateSelector selector, StreamingContext context, bool checkSecurity) { if (checkSecurity) { CodeAccessPermission.DemandInternal(PermissionType.SecuritySerialization); } m_fixupCount=0; m_objects = new ObjectHolder[DefaultInitialSize]; m_specialFixupObjects = null; m_selector = selector; m_context = context; }
private void EnlargeArray() { int num = this.m_values.Length * 2; if (num < 0) { if (num == 0x7fffffff) { throw new SerializationException(Environment.GetResourceString("Serialization_TooManyElements")); } num = 0x7fffffff; } ObjectHolder[] destinationArray = new ObjectHolder[num]; Array.Copy(this.m_values, destinationArray, this.m_count); this.m_values = destinationArray; }
private void EnlargeArray() { BCLDebug.Trace("SER", "[ObjectHolderList.EnlargeArray]Enlarging array of size ", m_values.Length); int newLength = m_values.Length*2; if (newLength<0) { if (newLength==Int32.MaxValue) { throw new SerializationException(Environment.GetResourceString("Serialization_TooManyElements")); } newLength=Int32.MaxValue; } ObjectHolder[] temp = new ObjectHolder[newLength]; Array.Copy(m_values, temp, m_count); m_values = temp; }
internal ObjectHolderList(int startingSize) { BCLDebug.Assert(startingSize>0 && startingSize<0x1000,"startingSize>0 && startingSize<0x1000"); m_count =0; m_values = new ObjectHolder[startingSize]; }
/*===============================AddObjectHolder================================ **Action: Add the provided ObjectHolder to collection of ObjectHolders. ** Enlarges the collection as appropriate. **Returns: void **Arguments: holder The ObjectHolder to be added. **Exceptions: Internal only. Caller should verify that <CODE>holder</CODE> is ** not null. ==============================================================================*/ private void AddObjectHolder(ObjectHolder holder) { BCLDebug.Assert(holder!=null,"holder!=null"); BCLDebug.Trace("SER", "[AddObjectHolder]Adding ObjectHolder with id: ", holder.m_id, " Current Bins: ", m_objects.Length); BCLDebug.Assert(holder.m_id>=0,"holder.m_id>=0"); //If the id that we need to place is greater than our current length, and less //than the maximum allowable size of the array. We need to double the size //of the array. If the array has already reached it's maximum allowable size, //we chain elements off of the buckets. if (holder.m_id>=m_objects.Length && m_objects.Length != MaxArraySize) { int newSize=MaxArraySize; if (holder.m_id<(MaxArraySize/2)) { newSize = (m_objects.Length * 2); //Keep doubling until we're larger than our target size. //We could also do this with log operations, but that would //be slower than the brute force approach. while (newSize<=holder.m_id && newSize<MaxArraySize) { newSize*=2; } if (newSize>MaxArraySize) { newSize=MaxArraySize; } } BCLDebug.Trace("SER", "[AddObjectHolder]Reallocating m_objects to have ", newSize, " bins"); ObjectHolder[] temp = new ObjectHolder[newSize]; Array.Copy(m_objects, temp, m_objects.Length); m_objects = temp; } //Find the bin in which we live and make this new element the first element in the bin. int index = (int)(holder.m_id & ArrayMask); BCLDebug.Trace("SER", "[AddObjectHolder]Trying to put an object in bin ", index); ObjectHolder tempHolder = m_objects[index]; holder.m_next = tempHolder; m_objects[index] = holder; }
private void AddObjectHolder(ObjectHolder holder) { Debug.Assert(holder != null, "holder!=null"); Debug.Assert(holder._id >= 0, "holder.m_id>=0"); //If the id that we need to place is greater than our current length, and less //than the maximum allowable size of the array. We need to double the size //of the array. If the array has already reached it's maximum allowable size, //we chain elements off of the buckets. if (holder._id >= _objects.Length && _objects.Length != MaxArraySize) { int newSize = MaxArraySize; if (holder._id < (MaxArraySize / 2)) { newSize = (_objects.Length * 2); //Keep doubling until we're larger than our target size. //We could also do this with log operations, but that would //be slower than the brute force approach. while (newSize <= holder._id && newSize < MaxArraySize) { newSize *= 2; } if (newSize > MaxArraySize) { newSize = MaxArraySize; } } ObjectHolder[] temp = new ObjectHolder[newSize]; Array.Copy(_objects, 0, temp, 0, _objects.Length); _objects = temp; } //Find the bin in which we live and make this new element the first element in the bin. int index = (int)(holder._id & ArrayMask); ObjectHolder tempHolder = _objects[index]; holder._next = tempHolder; _objects[index] = holder; }
private void EnlargeArray() { int newLength = _values.Length * 2; if (newLength < 0) { if (newLength == int.MaxValue) { throw new SerializationException(SR.Serialization_TooManyElements); } newLength = int.MaxValue; } ObjectHolder[] temp = new ObjectHolder[newLength]; Array.Copy(_values, 0, temp, 0, _count); _values = temp; }
internal ObjectHolderList(int startingSize) { this.m_count = 0; this.m_values = new ObjectHolder[startingSize]; }