CR-Client: Prevent Plugin2Handler from loading all DLLs to find a CLSID it will never find
"Henry Ping" <[email protected]>
| Newsgroups | gmane.comp.multimedia.helix.devel |
|---|---|
| Organization | RealNetworks |
| Message-ID | <[email protected]> |
> -----Original Message----- > From: Henry Ping [mailto:[email protected]] > Sent: Friday, May 15, 2009 12:33 PM > To: '[email protected]' > Subject: CR-Client: Prevent Plugin2Handler from loading all > DLLs to find a CLSID it will never find > > Plugin2Handler supports CommonClassFactory(CCF) plugins. This > is the legacy way of creating new object from plugin and is > deprecated by IHXComponentPlugin. However, there are still a > few CCF plugins haven't been switched to use IHXComponentPlugin. > > The problem surfaces when there is no CCF Plugin, the current > logic in Plugin2Handler will re-scan(load) all the DLLs even > though the DLLs haven't been changed, in other words, it will > not find any new CCF plugin. Application will suffer > performance problem because of this. > > The fix is to *only* rescan the DLLs for new CCF plugin if > and only if we detect any of the plugin DLLs are > dirty(added/modified). > > Diffs: > Index: plghand2.cpp > =================================================================== > RCS file: /cvsroot/client/common/container/plghand2.cpp,v > retrieving revision 1.55.2.3 > diff -u -w -4 -r1.55.2.3 plghand2.cpp > --- plghand2.cpp 19 Jan 2009 23:36:08 -0000 1.55.2.3 > +++ plghand2.cpp 15 May 2009 17:11:07 -0000 > @@ -300,8 +300,9 @@ > , m_nCacheSizeBites( (1<<24) ) > , m_pIScheduler(NULL) > , m_hScheduler( 0 ) > , m_bStatDllsOnStartup(TRUE) > + , m_bReScanCCFPlugins(FALSE) > { > #if defined(_DEBUG) && defined(_WINDOWS) > char szDbgStr[256]; > sprintf(szDbgStr, "CON Plugin2Handler[%p]\n", this); @@ > -949,8 +950,13 @@ > } > pszDllName = pFileFinder->FindNext(); > > } > + > + // We will rescan CCF Plugins if we detect plugin is > dirty(added/modified) in > + // any one of the MountPoints > + m_bReScanCCFPlugins |= bDLLIsDirty; > + > // now get the bandwidth data on all renderer plugins > IHXValues* pVal = NULL; > IHXBuffer* pBuffer = NULL; > > @@ -2062,9 +2068,18 @@ > IHXCommonClassFactory* pIHXCommonClassFactoryCurrent = NULL; > IHXPlugin* pIHXPluginCurrent = NULL; > IHXObjectConfiguration* pIHXObjectConfigurationCurrent = NULL; > > + // We only rescan the CCF plugins if we detected plugins > are dirty. > + // Otherwise, we'll assume CCF plugins have been scanned. > + // > + // This prevents plugins from being un-necessary loaded > and reduce > + // startup time. > + if (m_bReScanCCFPlugins) > + { > + m_bReScanCCFPlugins = FALSE; > AddSupportedIID(IID_IHXCommonClassFactory); > + } > > hxRes = GetNumPluginsSupporting( > IID_IHXCommonClassFactory, ulNumClassFactories ); > > if( SUCCEEDED(hxRes) && ulNumClassFactories > 0 ) > Index: pub/plghand2.h > =================================================================== > RCS file: /cvsroot/client/common/container/pub/plghand2.h,v > retrieving revision 1.16 > diff -u -w -4 -r1.16 plghand2.h > --- pub/plghand2.h 6 Jul 2007 21:57:57 -0000 1.16 > +++ pub/plghand2.h 15 May 2009 17:11:07 -0000 > @@ -737,8 +737,10 @@ > REF(IUnknown*) pIUnkResult, > IUnknown* pIUnkOuter); > > > + HXBOOL m_bReScanCCFPlugins; > + > CHXMapStringToOb m_MountPoints; > CHXSimpleList m_PluginDLLList; > CHXSimpleList m_PluginList; > CHXSimpleList m_MiscDLLList; > > Branches: > HEAD & Atlas310 > > Thanks > Henry