Ejemplo n.º 1
0
        protected override void OnSave(InterDomainContext context)
        {
            base.OnSave(context);
            System.Diagnostics.Debug.Assert(dict == GetObjectDict(pyHandle));
            foreach (var attr in cache.Values)
            {
                Runtime.XIncref(attr.pyHandle);
            }
            // Decref twice in tp_clear, equilibrate them.
            Runtime.XIncref(dict);
            Runtime.XIncref(dict);
            // destroy the cache(s)
            foreach (var pair in cache)
            {
                if ((Runtime.PyDict_DelItemString(DictRef, pair.Key) == -1) &&
                    (Exceptions.ExceptionMatches(Exceptions.KeyError)))
                {
                    // Trying to remove a key that's not in the dictionary
                    // raises an error. We don't care about it.
                    Runtime.PyErr_Clear();
                }
                else if (Exceptions.ErrorOccurred())
                {
                    throw new PythonException();
                }
                pair.Value.DecrRefCount();
            }

            cache.Clear();
        }
Ejemplo n.º 2
0
        protected override void OnLoad(InterDomainContext context)
        {
            base.OnLoad(context);
            GCHandle gc = AllocGCHandle(TrackTypes.Wrapper);

            SetGCHandle(ObjectReference, TypeReference, gc);
        }
Ejemplo n.º 3
0
        protected override void OnLoad(InterDomainContext context)
        {
            base.OnLoad(context);
            GCHandle gc = AllocGCHandle(TrackTypes.Wrapper);

            Marshal.WriteIntPtr(pyHandle, ObjectOffset.magic(tpHandle), (IntPtr)gc);
        }
Ejemplo n.º 4
0
 protected override void OnSave(InterDomainContext context)
 {
     base.OnSave(context);
     if (unbound != null)
     {
         Runtime.XIncref(unbound.pyHandle);
     }
     Runtime.XIncref(doc);
 }
Ejemplo n.º 5
0
 protected override void OnSave(InterDomainContext context)
 {
     base.OnSave(context);
     if (pyHandle != tpHandle)
     {
         IntPtr dict = GetObjectDict(pyHandle);
         Runtime.XIncref(dict);
         context.Storage.AddValue("dict", dict);
     }
 }
Ejemplo n.º 6
0
 protected override void OnSave(InterDomainContext context)
 {
     base.OnSave(context);
     if (!this.IsClrMetaTypeInstance())
     {
         IntPtr dict = GetObjectDict(pyHandle);
         Runtime.XIncref(dict);
         context.Storage.AddValue("dict", dict);
     }
 }
Ejemplo n.º 7
0
 protected override void OnLoad(InterDomainContext context)
 {
     base.OnLoad(context);
     if (pyHandle != tpHandle)
     {
         IntPtr dict = context.Storage.GetValue <IntPtr>("dict");
         SetObjectDict(pyHandle, dict);
     }
     gcHandle = AllocGCHandle();
     SetGCHandle(ObjectReference, gcHandle);
 }
Ejemplo n.º 8
0
 protected override void OnLoad(InterDomainContext context)
 {
     base.OnLoad(context);
     if (pyHandle != tpHandle)
     {
         IntPtr dict = context.Storage.GetValue <IntPtr>("dict");
         SetObjectDict(pyHandle, dict);
     }
     gcHandle = AllocGCHandle();
     Marshal.WriteIntPtr(pyHandle, TypeOffset.magic(), (IntPtr)gcHandle);
 }
Ejemplo n.º 9
0
        internal static CLRObject Restore(object ob, IntPtr pyHandle, InterDomainContext context)
        {
            CLRObject co = new CLRObject()
            {
                inst     = ob,
                pyHandle = pyHandle,
                tpHandle = Runtime.PyObject_TYPE(pyHandle)
            };

            co.Load(context);
            return(co);
        }
Ejemplo n.º 10
0
 protected override void OnSave(InterDomainContext context)
 {
     base.OnSave(context);
     System.Diagnostics.Debug.Assert(dict == GetObjectDict(pyHandle));
     foreach (var attr in cache.Values)
     {
         Runtime.XIncref(attr.pyHandle);
     }
     // Decref twice in tp_clear, equilibrate them.
     Runtime.XIncref(dict);
     Runtime.XIncref(dict);
 }
Ejemplo n.º 11
0
 protected override void OnLoad(InterDomainContext context)
 {
     base.OnLoad(context);
     SetObjectDict(pyHandle, dict);
 }
Ejemplo n.º 12
0
 protected virtual void OnLoad(InterDomainContext context)
 {
 }
Ejemplo n.º 13
0
 protected virtual void OnSave(InterDomainContext context)
 {
 }
Ejemplo n.º 14
0
 internal void Load(InterDomainContext context)
 {
     OnLoad(context);
 }
Ejemplo n.º 15
0
 protected override void OnSave(InterDomainContext context)
 {
     base.OnSave(context);
     Runtime.XIncref(target);
     Runtime.XIncref(targetType);
 }
Ejemplo n.º 16
0
 protected override void OnSave(InterDomainContext context)
 {
     base.OnSave(context);
     Runtime.XIncref(pyHandle);
 }
Ejemplo n.º 17
0
 protected override void OnLoad(InterDomainContext context)
 {
     base.OnLoad(context);
     SetupGc();
 }
Ejemplo n.º 18
0
 internal void Save(InterDomainContext context)
 {
     OnSave(context);
 }