home *** CD-ROM | disk | FTP | other *** search
- // clsview.hpp
- //
- // Created 10/05/98
- //
- // (C)Copyright 1998-1999 Microsoft Corporation, All rights reserved.
- //
-
- #ifndef __CLSVIEW_HPP__
- #define __CLSVIEW_HPP__
-
- #include "baseview.hpp"
-
-
- #define WC_HEAPMONITOR_CLASSLISTVIEWER "JavaHeapMonitor_ClassListViewerClass"
-
-
- enum ClassViewerEvents
- {
- CVWM_FIRST = WM_BC_LAST,
-
- CVWM_SNAPSHOT = CVWM_FIRST,
-
- CVWM_LAST,
- };
-
-
- // These are the fixed columns. Two additional columns, "total size" and
- // "average age" are added if those capabilities are supported.
- #define CLV_COL_CLASSNAME 0
- #define CLV_COL_TOTALINSTANCES 1
- #define CLV_COL_LIVEINSTANCES 2
- #define CLV_COL_LIVESIZE 3
- #define CLV_NUM_COLUMNS 4
-
-
- class ClassListViewer : public BasicClient
- {
- private:
-
- static BOOL s_fRegisteredClass;
-
- HWND m_list;
-
- struct ClassDataSnapshot
- {
- CLASSID id;
- __int64 totalinstances;
- // Indicates that the following fields are valid
- BOOL valid;
- ULONG liveinstances;
- ULONG totalsize;
- ULONG livesize;
- ULONG agesum;
- };
-
-
- //------------------------------------------------------------------------
- // UI stuff
-
- static LRESULT CALLBACK WndProc (HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
- BOOL OnCreateWindow ();
-
- static int PopulateListCB (ID id, PVOID token);
-
- BOOL AddClass (CLASSID cls);
- VOID UpdateClassData (ClassDataSnapshot *pdata);
-
- VOID RedrawList ()
- {
- InvalidateRect(m_list, NULL, TRUE);
- UpdateWindow(m_list);
- }
-
- int m_sortcol;
- int m_sortdir;
-
- static int CALLBACK SortColumnCB (LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);
-
-
- //------------------------------------------------------------------------
-
- // IHeapMonitorClient methods
-
- STDMETHODIMP OnStoppedExecution ()
- {
- return S_OK;
- }
-
- STDMETHODIMP OnResumeExecution ()
- {
- return S_OK;
- }
-
- STDMETHODIMP OnThreadCreated (THREADID thread)
- {
- return E_UNEXPECTED;
- }
-
- STDMETHODIMP OnDestroyThread (THREADID thread)
- {
- return E_UNEXPECTED;
- }
-
- STDMETHODIMP OnPackageCreated (PKGID pkg)
- {
- return S_OK;
- }
-
- STDMETHODIMP OnClassLoaded (CLASSID cls)
- {
- AddClass(cls);
- return S_OK;
- }
-
- STDMETHODIMP OnUnloadClass (CLASSID cls)
- {
- // TODO
- return S_OK;
- }
-
- STDMETHODIMP RootReferences (RootReferencesEventInfo *pinfo)
- {
- return E_UNEXPECTED;
- }
-
- STDMETHODIMP RootDiscoveryComplete ()
- {
- return E_UNEXPECTED;
- }
-
- STDMETHODIMP OnObjectStatusChange (OBJID id)
- {
- return E_UNEXPECTED;
- }
-
- STDMETHODIMP ObjectDiscoveryComplete ()
- {
- SendMessage(m_hwnd, CVWM_SNAPSHOT, 0, 0);
- RedrawList();
- return S_OK;
- }
-
-
- //------------------------------------------------------------------------
-
- public:
-
- ClassListViewer ()
- {
- m_sortcol = -1;
- }
-
- BOOL Initialize (HeapMonitorManager *mgr);
- };
-
-
- #endif /* __CLSVIEW_HPP__ */
-
-