diff options
Diffstat (limited to 'src/md/enc/rwutil.cpp')
-rw-r--r-- | src/md/enc/rwutil.cpp | 143 |
1 files changed, 0 insertions, 143 deletions
diff --git a/src/md/enc/rwutil.cpp b/src/md/enc/rwutil.cpp index 874d972716..a00eddb3f1 100644 --- a/src/md/enc/rwutil.cpp +++ b/src/md/enc/rwutil.cpp @@ -952,149 +952,6 @@ ErrExit: - -//********************************************************************************************************* -// -// Merge Token manager's constructor -// -//********************************************************************************************************* -MergeTokenManager::MergeTokenManager(MDTOKENMAP *pTkMapList, IUnknown *pHandler) -{ - m_cRef = 1; - m_pTkMapList = pTkMapList; - m_pDefaultHostRemap = NULL; - if (pHandler) - pHandler->QueryInterface(IID_IMapToken, (void **) &m_pDefaultHostRemap); -} // TokenManager::TokenManager() - - - -//********************************************************************************************************* -// -// Merge Token manager's destructor -// -//********************************************************************************************************* -MergeTokenManager::~MergeTokenManager() -{ - if (m_pDefaultHostRemap) - m_pDefaultHostRemap->Release(); -} // TokenManager::~TokenManager() - - - - -ULONG MergeTokenManager::AddRef() -{ - return InterlockedIncrement(&m_cRef); -} // TokenManager::AddRef() - - - -ULONG MergeTokenManager::Release() -{ - ULONG cRef = InterlockedDecrement(&m_cRef); - if (!cRef) - delete this; - return (cRef); -} // TokenManager::Release() - - -HRESULT MergeTokenManager::QueryInterface(REFIID riid, void **ppUnk) -{ - if (ppUnk == NULL) - return E_INVALIDARG; - - if (IsEqualIID(riid, IID_IMapToken)) - { - //*ppUnk = (IUnknown *) (IMapToken *) this; - // it should return the accurate type requested, - // if IUnknown is returned, it will finally converted to IMapToken* - *ppUnk = (IMapToken *) this; - } - else if (IsEqualIID(riid, IID_IUnknown)) - { - // add query handling for IUnknown - // this upcasting (converting a derived-class - // reference or pointer to a base-class) is safe - *ppUnk = (IUnknown *) this; - } - else - { - *ppUnk = NULL; - return (E_NOINTERFACE); - } - - AddRef(); - return (S_OK); -} // TokenManager::QueryInterface - - - -//********************************************************************************************************* -// -// Token manager keep tracks a list of tokenmaps. Each tokenmap corresponding -// to an imported scope. Note that with this, we do have problem in how to -// tell linker regarding the token movement when the token is added by Define -// rather than merge. This should be fixed with new merge implementation. -// The tkImp is the old tokens in the emit scope, tkEmit is the new token in the -// emit scope. We need to find the token from an import scope that is resolved -// to the tkImp. We then need to tell linker about this token movement. -// If we don't find any import scope which generates the tkImp token, that is -// this tkImp is generated by calling DefinXXX directly on the final merged scope. -// Then we use the default host remap to send the notification. -// -//********************************************************************************************************* -HRESULT MergeTokenManager::Map(mdToken tkImp, mdToken tkEmit) -{ - HRESULT hr = NOERROR; - MDTOKENMAP *pTkMapList = m_pTkMapList; - bool fFoundInImport = false; - int iPosition; - TOKENREC *pRec; - - _ASSERTE(m_pTkMapList); - while ( pTkMapList ) - { - // FindWithToToken will return the first match with the To token. - // pTkMapList is sorted with To token. It might contain several From tokens - // that map to the To token due to ref to def optimiation. Make sure that - // all notification is sent to all of these From tokens. - // - if ( pTkMapList->FindWithToToken(tkImp, &iPosition) ) - { - // make sure that we don't walk over the last entry - while (iPosition < pTkMapList->Count()) - { - pRec = pTkMapList->Get(iPosition); - if (pRec->m_tkTo != tkImp) - { - // we are done! - break; - } - - // more matching record... - fFoundInImport = true; - if (pTkMapList->m_pMap) - hr = pTkMapList->m_pMap->Map(pRec->m_tkFrom, tkEmit); - _ASSERTE(SUCCEEDED(hr)); - IfFailGo( hr ); - iPosition++; - } - } - pTkMapList = pTkMapList->m_pNextMap; - } - - if (fFoundInImport == false && m_pDefaultHostRemap) - { - // use the default remap to send the notification - IfFailGo( m_pDefaultHostRemap->Map(tkImp, tkEmit) ); - } -ErrExit: - return hr; -} - - - //********************************************************************************************************* // // CMapToken's constructor |