diff options
author | Andreas Strid <andreas_strid@bredband.net> | 2015-12-21 15:33:18 +0100 |
---|---|---|
committer | Andreas Strid <andreas_strid@bredband.net> | 2016-01-31 17:33:53 +0100 |
commit | 4c375f4ddfb1d35fd57d6f208e9de30350b4dbdd (patch) | |
tree | 2a4aaff0604b37f4bef68fbef46fe4afd7cbbb79 /src/vm/profilingenumerators.h | |
parent | 85f256e9b41cac20834d9695675e3ac8694454f9 (diff) | |
download | coreclr-4c375f4ddfb1d35fd57d6f208e9de30350b4dbdd.tar.gz coreclr-4c375f4ddfb1d35fd57d6f208e9de30350b4dbdd.tar.bz2 coreclr-4c375f4ddfb1d35fd57d6f208e9de30350b4dbdd.zip |
Enabling profiling on Unix/OS X.
Diffstat (limited to 'src/vm/profilingenumerators.h')
-rw-r--r-- | src/vm/profilingenumerators.h | 61 |
1 files changed, 32 insertions, 29 deletions
diff --git a/src/vm/profilingenumerators.h b/src/vm/profilingenumerators.h index 5f5d4f487e..19802b98fb 100644 --- a/src/vm/profilingenumerators.h +++ b/src/vm/profilingenumerators.h @@ -29,17 +29,14 @@ // (e.g., ICorProfilerObjectEnum) // Element -- the type of the objects this enumerator returns. // -// pEnumInterfaceIID -- pointer to the class ID for this interface -// (you probably don't need to use this) // -// -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID = &__uuidof(EnumInterface) > +template< typename EnumInterface, typename Element > class ProfilerEnum : public EnumInterface { public: ProfilerEnum(CDynArray< Element >* elements); ProfilerEnum(); - ~ProfilerEnum(); + virtual ~ProfilerEnum(); // IUnknown functions @@ -67,8 +64,14 @@ protected: CDynArray< Element > m_elements; LONG m_refCount; + +private: + static const IID& m_pEnumInterfaceIID; }; +template< typename EnumInterface, typename Element > +const IID& ProfilerEnum< EnumInterface, Element >::m_pEnumInterfaceIID = __uuidof(EnumInterface); + // // // ProfilerEnum implementation @@ -98,8 +101,8 @@ protected: // </TODO> // // -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::ProfilerEnum(CDynArray< Element >* elements) : +template< typename EnumInterface, typename Element > +ProfilerEnum< EnumInterface, Element >::ProfilerEnum(CDynArray< Element >* elements) : m_currentElement(0), m_refCount(1) { @@ -120,8 +123,8 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::ProfilerEnum(CDynArra } } -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::ProfilerEnum() : +template< typename EnumInterface, typename Element > +ProfilerEnum< EnumInterface, Element >::ProfilerEnum() : m_currentElement(0), m_refCount(1) { @@ -140,8 +143,8 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::ProfilerEnum() : // Returns // None // -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::~ProfilerEnum() +template< typename EnumInterface, typename Element > +ProfilerEnum< EnumInterface, Element >::~ProfilerEnum() { } @@ -160,11 +163,11 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::~ProfilerEnum() // E_NOINTERFACE -- if the enumerator does not implement the requested interface // -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > +template< typename EnumInterface, typename Element > HRESULT -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::QueryInterface(REFIID id, void** pInterface) +ProfilerEnum< EnumInterface, Element >::QueryInterface(REFIID id, void** pInterface) { - if (*pEnumInterfaceIID == id) + if (m_pEnumInterfaceIID == id) { *pInterface = static_cast< EnumInterface* >(this); } @@ -182,16 +185,16 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::QueryInterface(REFIID return S_OK; } -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > +template< typename EnumInterface, typename Element > ULONG -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::AddRef() +ProfilerEnum< EnumInterface, Element >::AddRef() { return InterlockedIncrement(&m_refCount); } -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > +template< typename EnumInterface, typename Element > ULONG -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Release() +ProfilerEnum< EnumInterface, Element >::Release() { ULONG refCount = InterlockedDecrement(&m_refCount); @@ -225,9 +228,9 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Release() // try to advance 1 item and return S_OK if it is successful // -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > +template< typename EnumInterface, typename Element > HRESULT -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Next(ULONG elementsRequested, +ProfilerEnum< EnumInterface, Element >::Next(ULONG elementsRequested, Element elements[], ULONG* elementsFetched) { @@ -307,9 +310,9 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Next(ULONG elementsRe // // -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > +template< typename EnumInterface, typename Element > HRESULT -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::GetCount(ULONG* count) +ProfilerEnum< EnumInterface, Element >::GetCount(ULONG* count) { CONTRACTL { @@ -352,9 +355,9 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::GetCount(ULONG* count // before and after calling Skip() // // -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > +template< typename EnumInterface, typename Element > HRESULT -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Skip(ULONG count) +ProfilerEnum< EnumInterface, Element >::Skip(ULONG count) { CONTRACTL { @@ -392,9 +395,9 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Skip(ULONG count) // // -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > +template< typename EnumInterface, typename Element > HRESULT -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Reset() +ProfilerEnum< EnumInterface, Element >::Reset() { CONTRACTL { @@ -424,9 +427,9 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Reset() // E_INVALIDARG -- if pInterface is an invalid pointer // -template< typename EnumInterface, typename Element, const IID* pEnumInterfaceIID > +template< typename EnumInterface, typename Element > HRESULT -ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Clone(EnumInterface** pInterface) +ProfilerEnum< EnumInterface, Element >::Clone(EnumInterface** pInterface) { CONTRACTL { @@ -446,7 +449,7 @@ ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >::Clone(EnumInterface** HRESULT hr = S_OK; EX_TRY { - *pInterface = new ProfilerEnum< EnumInterface, Element, pEnumInterfaceIID >(&m_elements); + *pInterface = new ProfilerEnum< EnumInterface, Element >(&m_elements); } EX_CATCH { |