home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 39 / IOPROG_39.ISO / SOFT / sdkjava40.exe / data1.cab / fg_Samples / Samples / Profiler / heapmon / obsearch.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-04  |  2.0 KB  |  107 lines

  1. // obsearch.hpp
  2. //
  3. // Created 11/15/98
  4. //
  5. // (C)Copyright 1998-1999 Microsoft Corporation, All rights reserved.
  6. //
  7.  
  8. #ifndef __OBSEARCH_HPP__
  9. #define __OBSEARCH_HPP__
  10.  
  11.  
  12. #include "ids.hpp"
  13. #include "walkheap.hpp"
  14.  
  15.  
  16. class RootReferencesRecorder;
  17. struct SearchOperation;
  18. class SearchHeapInfoCallback;
  19.  
  20.  
  21. typedef int SearchProc (ID id, ObjectID vmid, PVOID token);
  22.  
  23. enum SearchOperationType
  24. {
  25.     SOP_INVALID,
  26.     
  27.     SOP_INSTANCE_OF,
  28.     
  29.     SOP_REFERENCE_TO,
  30. };
  31.  
  32. struct SearchOperation
  33. {
  34.     SearchOperationType op;
  35.  
  36.     union
  37.     {
  38.         // SOP_INSTANCE_OF
  39.         struct {
  40.             ClassID cid;
  41.         } instanceof;
  42.  
  43.         // SOP_REFERENCE_TO
  44.         struct {
  45.             ObjectID oid;
  46.         } refersto;
  47.     };
  48.  
  49.     SearchProc *proc;
  50.     PVOID token;
  51.  
  52.     SearchOperation *next;
  53. };
  54.  
  55.  
  56. class SearchHeapInfoCallback : public IWalkHeapCallback
  57. {
  58.     HeapMonitorManager *m_mgr;
  59.     SearchOperation *m_workitems;
  60.     ULONG m_RefCount;
  61.  
  62. public:
  63.  
  64.     SearchHeapInfoCallback (HeapMonitorManager *mgr);
  65.  
  66.     ~SearchHeapInfoCallback ();
  67.  
  68.     VOID AddSearchOperation (SearchOperation *workitem);
  69.  
  70. private:
  71.  
  72.     // IWalkHeapCallback methods
  73.  
  74.     STDMETHODIMP BeginDump ();
  75.     STDMETHODIMP_(VOID) EndDump ();
  76.  
  77.     // IHeapInfoCallback methods
  78.  
  79.     STDMETHODIMP BeginContainer (CONTAINER_TYPE type, UniqueID id1, UniqueID id2)
  80.     {
  81.         return E_UNEXPECTED;
  82.     }
  83.     
  84.     STDMETHODIMP RootReferences (const ObjectID *prefs, unsigned nrefs, const DWORD *pflags)
  85.     {
  86.         return E_UNEXPECTED;
  87.     }
  88.  
  89.     static int FindRootRefsCB (ID id, ObjectID refvmid, PVOID token);
  90.     
  91.     STDMETHODIMP ObjectReferences (ObjectID vmid, DWORD flags, const ObjectID *prefs, unsigned nrefs, const DWORD *pflags);
  92.  
  93.  
  94. public:
  95.  
  96.     // IUnknown methods
  97.  
  98.     ULONG STDMETHODCALLTYPE AddRef (VOID);
  99.     ULONG STDMETHODCALLTYPE Release (VOID);
  100.     STDMETHODIMP QueryInterface (REFIID riid, PVOID *ppvObj);
  101. };
  102.  
  103.  
  104.  
  105. #endif /* __OBJSEARCH_HPP__ */
  106.  
  107.