Bug 298044 - Dynamically load XPCOM dependent libs as part of the XPCOM standalone glue bootstrap process, r=darin a=asa

git-svn-id: svn://10.0.0.236/trunk@176104 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bsmedberg%covad.net
2005-07-14 18:42:59 +00:00
parent 872b8aed8f
commit b0741b74a7
17 changed files with 612 additions and 289 deletions

View File

@@ -79,15 +79,13 @@ DLLStore_Destroy(nsHashKey *aKey, void *aData, void* closure)
nsNativeComponentLoader::nsNativeComponentLoader() :
mCompMgr(nsnull),
mLoadedDependentLibs(16, PR_TRUE),
mDllStore(nsnull, nsnull, DLLStore_Destroy,
nsnull, 256, PR_TRUE)
{
}
NS_IMPL_THREADSAFE_ISUPPORTS2(nsNativeComponentLoader,
nsIComponentLoader,
nsINativeComponentLoader)
NS_IMPL_THREADSAFE_ISUPPORTS1(nsNativeComponentLoader,
nsIComponentLoader)
NS_IMETHODIMP
nsNativeComponentLoader::GetFactory(const nsIID & aCID,
@@ -419,10 +417,6 @@ nsNativeComponentLoader::SelfRegisterDll(nsDll *dll,
*************************************************************/
nsresult res2 = dll->GetDllSpec(getter_AddRefs(fs)); // don't change 'res2' -- see warning, above
if (NS_SUCCEEDED(res2)) {
// in the case of re-registering a component, we want to remove
// any optional data that this file may have had.
AddDependentLibrary(fs, nsnull);
res = mobj->RegisterSelf(mCompMgr, fs, registryLocation,
nativeComponentType);
}
@@ -1063,36 +1057,3 @@ nsNativeComponentLoader::GetFactoryFromModule(nsDll *aDll, const nsCID &aCID,
return module->GetClassObject(mCompMgr, aCID, NS_GET_IID(nsIFactory),
(void **)aFactory);
}
NS_IMETHODIMP
nsNativeComponentLoader::AddDependentLibrary(nsIFile* aFile, const char* libName)
{
nsCOMPtr<nsIComponentLoaderManager> manager = do_QueryInterface(mCompMgr);
if (!manager)
{
NS_WARNING("Something is terribly wrong");
return NS_ERROR_FAILURE;
}
// the native component loader uses the optional data
// to store a space delimited list of dependent library
// names
if (!libName)
{
manager->SetOptionalData(aFile, nsnull, nsnull);
return NS_OK;
}
nsXPIDLCString data;
manager->GetOptionalData(aFile, nsnull, getter_Copies(data));
if (!data.IsEmpty())
data.AppendLiteral(" ");
data.Append(nsDependentCString(libName));
manager->SetOptionalData(aFile, nsnull, data);
return NS_OK;
}