⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hxpropwclnt.cpp

📁 linux下的一款播放器
💻 CPP
📖 第 1 页 / 共 2 页
字号:
HXClientPropWatch::PropWatchCallback::~PropWatchCallback(){}/* * IUnknown methods *////////////////////////////////////////////////////////////////////////////      Method://              IUnknown::QueryInterface//      Purpose://              Implement this to export the interfaces supported by your//              object.//STDMETHODIMP HXClientPropWatch::PropWatchCallback::QueryInterface(REFIID riid, void** ppvObj){    QInterfaceList qiList[] =        {            { GET_IIDHANDLE(IID_IHXCallback), (IHXCallback*)this },            { GET_IIDHANDLE(IID_IUnknown), (IUnknown*)(IHXCallback*)this },        };        return ::QIFind(qiList, QILISTSIZE(qiList), riid, ppvObj);}///////////////////////////////////////////////////////////////////////////      Method://              IUnknown::AddRef//      Purpose://              Everyone usually implements this the same... feel free to use//              this implementation.//STDMETHODIMP_(ULONG32) HXClientPropWatch::PropWatchCallback::AddRef(){    return InterlockedIncrement(&m_lRefCount);}///////////////////////////////////////////////////////////////////////////      Method://              IUnknown::Release//      Purpose://              Everyone usually implements this the same... feel free to use//              this implementation.//STDMETHODIMP_(ULONG32) HXClientPropWatch::PropWatchCallback::Release(){    if (InterlockedDecrement(&m_lRefCount) > 0)    {	return m_lRefCount;    }    delete this;    return 0;}/* *      IHXCallback methods */STDMETHODIMP HXClientPropWatch::PropWatchCallback::Func(void){    m_PendingHandle         = 0;    m_bIsCallbackPending    = FALSE;    if (m_pPropWatch && m_pPropWatch->m_pInternalResponse)    {	m_pPropWatch->m_pInternalResponse->ProcessPendingResponses();	m_pPropWatch->Release();    }    return HXR_OK;}// PropWatchResponseHXClientPropWatch::PropWatchResponse::PropWatchResponse(HXClientPropWatch* pClientPropWatch) :     m_lRefCount (0)    ,m_pPropWatch(pClientPropWatch)    ,m_pPendingResponseList (NULL){#ifdef THREADS_SUPPORTED    HXMutex::MakeMutex(m_pMutex);#else    HXMutex::MakeStubMutex(m_pMutex);#endif}HXClientPropWatch::PropWatchResponse::~PropWatchResponse(){    m_pMutex->Lock();        while (m_pPendingResponseList && m_pPendingResponseList->GetCount() > 0)    {	PropResponseValues* pValues = (PropResponseValues*) 					m_pPendingResponseList->RemoveHead();	delete pValues;    }    HX_DELETE(m_pPendingResponseList);        m_pMutex->Unlock();        HX_DELETE(m_pMutex);}/* * IUnknown methods *////////////////////////////////////////////////////////////////////////////      Method://              IUnknown::QueryInterface//      Purpose://              Implement this to export the interfaces supported by your//              object.//STDMETHODIMP HXClientPropWatch::PropWatchResponse::QueryInterface(REFIID riid, void** ppvObj){    QInterfaceList qiList[] =        {            { GET_IIDHANDLE(IID_IHXPropWatchResponse), (IHXPropWatchResponse*)this },            { GET_IIDHANDLE(IID_IUnknown), (IUnknown*)(IHXPropWatchResponse*)this },        };        return ::QIFind(qiList, QILISTSIZE(qiList), riid, ppvObj);}///////////////////////////////////////////////////////////////////////////      Method://              IUnknown::AddRef//      Purpose://              Everyone usually implements this the same... feel free to use//              this implementation.//STDMETHODIMP_(ULONG32) HXClientPropWatch::PropWatchResponse::AddRef(){    return InterlockedIncrement(&m_lRefCount);}///////////////////////////////////////////////////////////////////////////      Method://              IUnknown::Release//      Purpose://              Everyone usually implements this the same... feel free to use//              this implementation.//STDMETHODIMP_(ULONG32) HXClientPropWatch::PropWatchResponse::Release(){    if (InterlockedDecrement(&m_lRefCount) > 0)    {	return m_lRefCount;    }    delete this;    return 0;}/* *	IHXPropWatchResponse methods */STDMETHODIMPHXClientPropWatch::PropWatchResponse::AddedProp(const UINT32		id,			     const HXPropType   	propType,			     const UINT32		ulParentID){    /* If we are at interrupt time, make sure that the      * response is interrupt safe     */    if (m_pPropWatch->m_pInterruptState &&	m_pPropWatch->m_pInterruptState->AtInterruptTime() &&	(!m_pPropWatch->m_pInterruptSafeResponse ||	!m_pPropWatch->m_pInterruptSafeResponse->IsInterruptSafe()))    {	ScheduleCallback(ADDEDPROP, id, propType, ulParentID);    }    else    {	ProcessPendingResponses();	m_pPropWatch->m_pResponse->AddedProp(id, propType, ulParentID);    }    return HXR_OK;}STDMETHODIMPHXClientPropWatch::PropWatchResponse::ModifiedProp(const UINT32		id,			     const HXPropType   	propType,			     const UINT32		ulParentID){    /* If we are at interrupt time, make sure that the      * response is interrupt safe     */    if (m_pPropWatch->m_pInterruptState &&	m_pPropWatch->m_pInterruptState->AtInterruptTime() &&	(!m_pPropWatch->m_pInterruptSafeResponse ||	!m_pPropWatch->m_pInterruptSafeResponse->IsInterruptSafe()))    {	ScheduleCallback(MODIFIEDPROP, id, propType, ulParentID);    }    else    {	ProcessPendingResponses();	m_pPropWatch->m_pResponse->ModifiedProp(id, propType, ulParentID);    }    return HXR_OK;}STDMETHODIMPHXClientPropWatch::PropWatchResponse::DeletedProp(const UINT32		id,			     const UINT32		ulParentID){    /* If we are at interrupt time, make sure that the      * response is interrupt safe     */    if (m_pPropWatch->m_pInterruptState &&	m_pPropWatch->m_pInterruptState->AtInterruptTime() &&	(!m_pPropWatch->m_pInterruptSafeResponse ||	!m_pPropWatch->m_pInterruptSafeResponse->IsInterruptSafe()))    {	ScheduleCallback(DELETEDPROP, id, (HXPropType) 0, ulParentID);    }    else    {	ProcessPendingResponses();	m_pPropWatch->m_pResponse->DeletedProp(id, ulParentID);    }    return HXR_OK;}voidHXClientPropWatch::PropWatchResponse::ScheduleCallback(ResponseType	uResponseType,				    const UINT32		id,				    const HXPropType   	propType,				    const UINT32		ulParentID){    m_pMutex->Lock();        if (!m_pPendingResponseList)    {	m_pPendingResponseList = new CHXSimpleList;    }    PropResponseValues* pValues = new PropResponseValues(uResponseType, id, 						    propType, ulParentID);    m_pPendingResponseList->AddTail((void*) pValues);    if (!m_pPropWatch->m_pCallback)    {	m_pPropWatch->m_pCallback = new PropWatchCallback(m_pPropWatch);	m_pPropWatch->m_pCallback->AddRef();    }    if (!m_pPropWatch->m_pCallback->m_bIsCallbackPending &&	m_pPropWatch->m_pScheduler)    {	m_pPropWatch->AddRef();		m_pPropWatch->m_pCallback->m_bIsCallbackPending = TRUE;	m_pPropWatch->m_pCallback->m_PendingHandle = 	    m_pPropWatch->m_pScheduler->RelativeEnter(				    m_pPropWatch->m_pCallback, 0);    }        m_pMutex->Unlock();}voidHXClientPropWatch::PropWatchResponse::ProcessPendingResponses(){    /* remove any pending callback */    if (m_pPropWatch->m_pCallback &&	m_pPropWatch->m_pCallback->m_bIsCallbackPending &&	m_pPropWatch->m_pScheduler)    {	m_pPropWatch->m_pCallback->m_bIsCallbackPending = FALSE;	m_pPropWatch->m_pScheduler->Remove(			m_pPropWatch->m_pCallback->m_PendingHandle);    }    m_pMutex->Lock();        while (m_pPendingResponseList && m_pPendingResponseList->GetCount() > 0)    {	PropResponseValues* pValues = (PropResponseValues*) 					m_pPendingResponseList->RemoveHead();	switch (pValues->m_uResponseType)	{	    case ADDEDPROP:		m_pPropWatch->m_pResponse->AddedProp(pValues->m_ulId, 						     pValues->m_propType,						     pValues->m_ulParentID);    		break;	    case MODIFIEDPROP:		m_pPropWatch->m_pResponse->ModifiedProp(pValues->m_ulId, 						      pValues->m_propType,						      pValues->m_ulParentID);		break;	    case DELETEDPROP:		m_pPropWatch->m_pResponse->DeletedProp(pValues->m_ulId, 						       pValues->m_ulParentID);		break;	    default:		HX_ASSERT(0);		break;	}	delete pValues;    }        m_pMutex->Unlock();}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -