Пример #1
0
 internal ObjectHolder(object obj, long objID, System.Runtime.Serialization.SerializationInfo info, ISerializationSurrogate surrogate, long idOfContainingObj, FieldInfo field, int[] arrayIndex)
 {
     this.m_object = obj;
     this.m_id = objID;
     this.m_flags = 0;
     this.m_missingElementsRemaining = 0;
     this.m_missingDecendents = 0;
     this.m_dependentObjects = null;
     this.m_next = null;
     this.m_serInfo = info;
     this.m_surrogate = surrogate;
     this.m_markForFixupWhenAvailable = false;
     if (obj is TypeLoadExceptionHolder)
     {
         this.m_typeLoad = (TypeLoadExceptionHolder) obj;
     }
     if ((idOfContainingObj != 0L) && (((field != null) && field.FieldType.IsValueType) || (arrayIndex != null)))
     {
         if (idOfContainingObj == objID)
         {
             throw new SerializationException(Environment.GetResourceString("Serialization_ParentChildIdentical"));
         }
         this.m_valueFixup = new ValueTypeFixupInfo(idOfContainingObj, field, arrayIndex);
     }
     this.SetFlags();
 }
Пример #2
0
 internal ObjectHolder(object obj, long objID, System.Runtime.Serialization.SerializationInfo info, ISerializationSurrogate surrogate, long idOfContainingObj, FieldInfo field, int[] arrayIndex)
 {
     this.m_object = obj;
     this.m_id     = objID;
     this.m_flags  = 0;
     this.m_missingElementsRemaining = 0;
     this.m_missingDecendents        = 0;
     this.m_dependentObjects         = null;
     this.m_next      = null;
     this.m_serInfo   = info;
     this.m_surrogate = surrogate;
     this.m_markForFixupWhenAvailable = false;
     if (obj is TypeLoadExceptionHolder)
     {
         this.m_typeLoad = (TypeLoadExceptionHolder)obj;
     }
     if ((idOfContainingObj != 0L) && (((field != null) && field.FieldType.IsValueType) || (arrayIndex != null)))
     {
         if (idOfContainingObj == objID)
         {
             throw new SerializationException(Environment.GetResourceString("Serialization_ParentChildIdentical"));
         }
         this.m_valueFixup = new ValueTypeFixupInfo(idOfContainingObj, field, arrayIndex);
     }
     this.SetFlags();
 }
        private void DoNewlyRegisteredObjectFixups(ObjectHolder holder)
        {
            if (holder.CanObjectValueChange)
            {
                return;
            }
            LongList dependentObjects = holder.DependentObjects;

            if (dependentObjects == null)
            {
                return;
            }
            dependentObjects.StartEnumeration();
            while (dependentObjects.MoveNext())
            {
                long         objectID     = dependentObjects.Current;
                ObjectHolder objectHolder = this.FindObjectHolder(objectID);
                objectHolder.DecrementFixupsRemaining(this);
                if (objectHolder.DirectlyDependentObjects == 0)
                {
                    if (objectHolder.ObjectValue != null)
                    {
                        this.CompleteObject(objectHolder, true);
                    }
                    else
                    {
                        objectHolder.MarkForCompletionWhenAvailable();
                    }
                }
            }
        }
Пример #4
0
 private void DoNewlyRegisteredObjectFixups(ObjectHolder holder)
 {
     if (!holder.CanObjectValueChange)
     {
         LongList dependentObjects = holder.DependentObjects;
         if (dependentObjects != null)
         {
             dependentObjects.StartEnumeration();
             while (dependentObjects.MoveNext())
             {
                 ObjectHolder holder2 = this.FindObjectHolder(dependentObjects.Current);
                 holder2.DecrementFixupsRemaining(this);
                 if (holder2.DirectlyDependentObjects == 0)
                 {
                     if (holder2.ObjectValue != null)
                     {
                         this.CompleteObject(holder2, true);
                     }
                     else
                     {
                         holder2.MarkForCompletionWhenAvailable();
                     }
                 }
             }
         }
     }
 }
Пример #5
0
 internal void AddDependency(long dependentObject)
 {
     if (this.m_dependentObjects == null)
     {
         this.m_dependentObjects = new LongList();
     }
     this.m_dependentObjects.Add(dependentObject);
 }
Пример #6
0
 internal ObjectHolder(string obj, long objID, System.Runtime.Serialization.SerializationInfo info, ISerializationSurrogate surrogate, long idOfContainingObj, FieldInfo field, int[] arrayIndex)
 {
     this.m_object = obj;
     this.m_id = objID;
     this.m_flags = 0;
     this.m_missingElementsRemaining = 0;
     this.m_missingDecendents = 0;
     this.m_dependentObjects = null;
     this.m_next = null;
     this.m_serInfo = info;
     this.m_surrogate = surrogate;
     this.m_markForFixupWhenAvailable = false;
     if ((idOfContainingObj != 0L) && (arrayIndex != null))
     {
         this.m_valueFixup = new ValueTypeFixupInfo(idOfContainingObj, field, arrayIndex);
     }
     if (this.m_valueFixup != null)
     {
         this.m_flags |= 8;
     }
 }
Пример #7
0
 internal ObjectHolder(string obj, long objID, System.Runtime.Serialization.SerializationInfo info, ISerializationSurrogate surrogate, long idOfContainingObj, FieldInfo field, int[] arrayIndex)
 {
     this.m_object = obj;
     this.m_id     = objID;
     this.m_flags  = 0;
     this.m_missingElementsRemaining = 0;
     this.m_missingDecendents        = 0;
     this.m_dependentObjects         = null;
     this.m_next      = null;
     this.m_serInfo   = info;
     this.m_surrogate = surrogate;
     this.m_markForFixupWhenAvailable = false;
     if ((idOfContainingObj != 0L) && (arrayIndex != null))
     {
         this.m_valueFixup = new ValueTypeFixupInfo(idOfContainingObj, field, arrayIndex);
     }
     if (this.m_valueFixup != null)
     {
         this.m_flags |= 8;
     }
 }
Пример #8
0
 internal ObjectHolder(string obj, long objID, SerializationInfo info, ISerializationSurrogate surrogate, long idOfContainingObj, FieldInfo field, int[] arrayIndex)
 {
     this.m_object = (object)obj;
     this.m_id     = objID;
     this.m_flags  = 0;
     this.m_missingElementsRemaining = 0;
     this.m_missingDecendents        = 0;
     this.m_dependentObjects         = (LongList)null;
     this.m_next      = (ObjectHolder)null;
     this.m_serInfo   = info;
     this.m_surrogate = surrogate;
     this.m_markForFixupWhenAvailable = false;
     if (idOfContainingObj != 0L && arrayIndex != null)
     {
         this.m_valueFixup = new ValueTypeFixupInfo(idOfContainingObj, field, arrayIndex);
     }
     if (this.m_valueFixup == null)
     {
         return;
     }
     this.m_flags = this.m_flags | 8;
 }
Пример #9
0
 /*================================AddDependency=================================
 **Action: Note an object which is dependent on the one which will be contained in
 **        this ObjectHolder.  Dependencies should only be added if the object hasn't
 **        yet been added.  NB: An incomplete object counts as having no object.
 **Returns: void
 **Arguments: dependentObject -- the id of the object which is dependent on this object being provided.
 **Exceptions: None.
 ==============================================================================*/
 internal virtual void AddDependency(long dependentObject) {
     if (m_dependentObjects==null) {
         m_dependentObjects = new LongList();
     }
     m_dependentObjects.Add(dependentObject);
 }
Пример #10
0
        internal ObjectHolder(String obj, long objID, SerializationInfo info, 
                              ISerializationSurrogate surrogate, long idOfContainingObj, FieldInfo field, int[] arrayIndex) {
            BCLDebug.Assert(objID>=0,"objID>=0");
            
            m_object=obj; //May be null;
            m_id=objID;
    
            m_flags=0;
            m_missingElementsRemaining=0;
            m_missingDecendents = 0;
            m_dependentObjects=null;
            m_next=null;
            
            m_serInfo = info;
            m_surrogate = surrogate;
            m_markForFixupWhenAvailable = false;

            if (idOfContainingObj!=0 && arrayIndex!=null) {
                m_valueFixup = new ValueTypeFixupInfo(idOfContainingObj, field, arrayIndex);
            }

            if (m_valueFixup!=null) {
                m_flags|=REQUIRES_VALUETYPE_FIXUP;
            }
        }
Пример #11
0
        internal ObjectHolder(Object obj, long objID, SerializationInfo info, 
                              ISerializationSurrogate surrogate, long idOfContainingObj, FieldInfo field, int[] arrayIndex) {
            BCLDebug.Assert(objID>=0,"objID>=0");
            
            m_object=obj; //May be null;
            m_id=objID;
    
            m_flags=0;
            m_missingElementsRemaining=0;
            m_missingDecendents = 0;
            m_dependentObjects=null;
            m_next=null;
            
            m_serInfo = info;
            m_surrogate = surrogate;
            m_markForFixupWhenAvailable = false;


            if (idOfContainingObj!=0 && ((field!=null && field.FieldType.IsValueType) || arrayIndex!=null)) {
                if (idOfContainingObj == objID) {
                    throw new SerializationException(Environment.GetResourceString("Serialization_ParentChildIdentical"));
                }

                m_valueFixup = new ValueTypeFixupInfo(idOfContainingObj, field, arrayIndex);
            }

            SetFlags();
        }
Пример #12
0
 internal void AddDependency(long dependentObject)
 {
     if (this.m_dependentObjects == null)
     {
         this.m_dependentObjects = new LongList();
     }
     this.m_dependentObjects.Add(dependentObject);
 }
Пример #13
0
        internal ObjectHolder(
            object obj, long objID, SerializationInfo info, ISerializationSurrogate surrogate,
            long idOfContainingObj, FieldInfo field, int[] arrayIndex)
        {
            Debug.Assert(objID >= 0, "objID>=0");

            _object = obj; //May be null;
            _id = objID;

            _flags = 0;
            _missingElementsRemaining = 0;
            _missingDecendents = 0;
            _dependentObjects = null;
            _next = null;

            _serInfo = info;
            _surrogate = surrogate;
            _markForFixupWhenAvailable = false;

            if (obj is TypeLoadExceptionHolder)
            {
                _typeLoad = (TypeLoadExceptionHolder)obj;
            }

            if (idOfContainingObj != 0 && ((field != null && field.FieldType.IsValueType) || arrayIndex != null))
            {
                if (idOfContainingObj == objID)
                {
                    throw new SerializationException(SR.Serialization_ParentChildIdentical);
                }

                _valueFixup = new ValueTypeFixupInfo(idOfContainingObj, field, arrayIndex);
            }

            SetFlags();
        }