예제 #1
0
        //index from an imaginary array composed of native objects followed by managed objects.
        public static ObjectData FromUnifiedObjectIndex(CachedSnapshot snapshot, int index)
        {
            int iNative = snapshot.UnifiedObjectIndexToNativeObjectIndex(index);

            if (iNative >= 0)
            {
                return(FromNativeObjectIndex(snapshot, iNative));
            }

            int iManaged = snapshot.UnifiedObjectIndexToManagedObjectIndex(index);

            if (iManaged >= 0)
            {
                return(FromManagedObjectIndex(snapshot, iManaged));
            }

            return(ObjectData.invalid);
        }
        static void AddupRawRefCount(CachedSnapshot snapshot)
        {
            for (long i = 0; i != snapshot.connections.Count; ++i)
            {
                int iManagedTo = snapshot.UnifiedObjectIndexToManagedObjectIndex(snapshot.connections.to[i]);
                if (iManagedTo >= 0)
                {
                    var obj = snapshot.CrawledData.ManagedObjects[iManagedTo];
                    ++obj.RefCount;
                    snapshot.CrawledData.ManagedObjects[iManagedTo] = obj;
                    continue;
                }

                int iNativeTo = snapshot.UnifiedObjectIndexToNativeObjectIndex(snapshot.connections.to[i]);
                if (iNativeTo >= 0)
                {
                    ++snapshot.nativeObjects.refcount[iNativeTo];
                    continue;
                }
            }
        }