Esempio n. 1
0
            public void Initialize(ManagedHeapSectionsControl owner, PackedMemorySnapshot snapshot, int memorySegmentIndex)
            {
                m_Owner    = owner;
                m_Snapshot = snapshot;
                arrayIndex = memorySegmentIndex;

                displayName = "MemorySection";
                address     = m_Snapshot.managedHeapSections[arrayIndex].startAddress;
                if (m_Snapshot.managedHeapSections[arrayIndex].bytes != null)
                {
                    size = (ulong)m_Snapshot.managedHeapSections[arrayIndex].bytes.LongLength;

#if HEAPEXPLORER_DISPLAY_REFS
                    m_Snapshot.GetConnectionsCount(m_Snapshot.managedHeapSections[arrayIndex], out refs);
#endif
                }
            }
        protected override void OnCreate()
        {
            base.OnCreate();

            ReleaseTextures();

            m_HexView   = CreateView <HexView>();
            m_ShowAsHex = EditorPrefs.GetBool(GetPrefsKey(() => m_ShowAsHex), false);

            m_SectionFragTexture      = new Texture2D(ManagedHeapSectionsUtility.k_TextureWidth, ManagedHeapSectionsUtility.k_TextureHeight, TextureFormat.ARGB32, false);
            m_SectionFragTexture.name = "HeapExplorer-MemorySectionFragmentation-Texture";

            m_HeapFragTexture      = new Texture2D(ManagedHeapSectionsUtility.k_TextureWidth, ManagedHeapSectionsUtility.k_TextureHeight, TextureFormat.ARGB32, false);
            m_HeapFragTexture.name = "HeapExplorer-HeapFragmentation-Texture";
            ScheduleJob(new HeapFragmentationJob()
            {
                snapshot = snapshot, texture = m_HeapFragTexture, sections = GetMemorySections(), addressSpace = GetHeapAddressSpace()
            });

            m_ConnectionsView = CreateView <ConnectionsView>();
            m_ConnectionsView.editorPrefsKey             = GetPrefsKey(() => m_ConnectionsView);
            m_ConnectionsView.showReferencedBy           = false;
            m_ConnectionsView.afterReferencesToolbarGUI += OnToggleHexViewGUI;

            m_SectionsControl = new ManagedHeapSectionsControl(window, GetPrefsKey(() => m_SectionsControl), new TreeViewState());
            m_SectionsControl.SetTree(m_SectionsControl.BuildTree(snapshot, GetMemorySections()));
            m_SectionsControl.onSelectionChange += OnListViewSelectionChange;

            m_SectionsSearchField = new HeSearchField(window);
            m_SectionsSearchField.downOrUpArrowKeyPressed += m_SectionsControl.SetFocusAndEnsureSelectedItem;
            m_SectionsControl.findPressed += m_SectionsSearchField.SetFocus;

            m_SplitterHorz = EditorPrefs.GetFloat(GetPrefsKey(() => m_SplitterHorz), m_SplitterHorz);

            m_ShowInternalSections = s_ShowInternalSections;
        }