Land STATIC_BUILD_20010612_BRANCH, which supports building mozilla with components statically linked into the executable, as well as 'meta modules' that combine components into uber-DLLs.

git-svn-id: svn://10.0.0.236/trunk@97613 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
waterson%netscape.com
2001-06-20 20:21:49 +00:00
parent 1aa28c50ac
commit 18986ada3f
394 changed files with 17124 additions and 3271 deletions

View File

@@ -110,6 +110,7 @@ const char classNameValueName[]="ClassName";
const char inprocServerValueName[]="InprocServer";
const char componentTypeValueName[]="ComponentType";
const char nativeComponentType[]="application/x-mozilla-native";
const char staticComponentType[]="application/x-mozilla-static";
const static char XPCOM_ABSCOMPONENT_PREFIX[] = "abs:";
const static char XPCOM_RELCOMPONENT_PREFIX[] = "rel:";
@@ -243,7 +244,8 @@ nsFactoryEntry::~nsFactoryEntry(void)
nsComponentManagerImpl::nsComponentManagerImpl()
: mFactories(NULL), mContractIDs(NULL), mLoaders(0), mMon(NULL),
mRegistry(NULL), mPrePopulationDone(PR_FALSE),
mNativeComponentLoader(0), mShuttingDown(NS_SHUTDOWN_NEVERHAPPENED)
mNativeComponentLoader(0), mStaticComponentLoader(0),
mShuttingDown(NS_SHUTDOWN_NEVERHAPPENED)
{
NS_INIT_REFCNT();
}
@@ -309,13 +311,27 @@ nsresult nsComponentManagerImpl::Init(void)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(mNativeComponentLoader);
}
if (mStaticComponentLoader == nsnull) {
#ifdef ENABLE_STATIC_COMPONENT_LOADER
extern nsresult NS_NewStaticComponentLoader(nsIComponentLoader **);
NS_NewStaticComponentLoader(&mStaticComponentLoader);
if (!mStaticComponentLoader)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(mStaticComponentLoader);
#endif
}
if (mLoaders == nsnull) {
mLoaders = new nsSupportsHashtable(16, /* Thread safe */ PR_TRUE);
if (mLoaders == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
nsCStringKey loaderKey(nativeComponentType);
mLoaders->Put(&loaderKey, mNativeComponentLoader);
mLoaders = new nsSupportsHashtable(16, /* Thread safe */ PR_TRUE);
if (mLoaders == nsnull)
return NS_ERROR_OUT_OF_MEMORY;
nsCStringKey loaderKey(nativeComponentType);
mLoaders->Put(&loaderKey, mNativeComponentLoader);
#ifdef ENABLE_STATIC_COMPONENT_LOADER
nsCStringKey staticKey(staticComponentType);
mLoaders->Put(&staticKey, mStaticComponentLoader);
#endif
}
#ifdef USE_REGISTRY
@@ -372,6 +388,9 @@ nsresult nsComponentManagerImpl::Shutdown(void)
// we have an extra reference on this one, which is probably a good thing
NS_IF_RELEASE(mNativeComponentLoader);
#ifdef ENABLE_STATIC_COMPONENT_LOADER
NS_IF_RELEASE(mStaticComponentLoader);
#endif
// Destroy the Lock
if (mMon)
@@ -479,6 +498,15 @@ nsComponentManagerImpl::PlatformInit(void)
PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
("no native component loader available for init"));
}
if (mStaticComponentLoader) {
/* now that we have the registry, Init the native loader */
rv = mStaticComponentLoader->Init(this, mRegistry);
} else {
PR_LOG(nsComponentManagerLog, PR_LOG_ERROR,
("no native component loader available for init"));
}
return rv;
}
@@ -1295,6 +1323,11 @@ nsComponentManagerImpl::RegistryLocationForSpec(nsIFile *aSpec,
if (!mComponentsDir)
return NS_ERROR_NOT_INITIALIZED;
if (!aSpec) {
*aRegistryName = nsCRT::strdup("");
return NS_OK;
}
PRBool containedIn;
mComponentsDir->Contains(aSpec, PR_TRUE, &containedIn);
@@ -1835,10 +1868,7 @@ CanUnload_enumerate(nsHashKey *key, void *aData, void *aClosure)
(struct CanUnload_closure *)aClosure;
if (loader == closure->native) {
#ifdef DEBUG
fprintf(stderr, "CanUnload_enumerate: skipping native\n");
#endif
return PR_TRUE;
return PR_TRUE;
}
closure->status = loader->UnloadAll(closure->when);
@@ -1919,7 +1949,7 @@ AutoRegister_enumerate(nsHashKey *key, void *aData, void *aClosure)
(struct AutoReg_closure *)aClosure;
if (loader == closure->native)
return PR_TRUE;
return PR_TRUE;
PR_ASSERT(NS_SUCCEEDED(closure->status));
@@ -2014,6 +2044,11 @@ nsComponentManagerImpl::AutoRegisterImpl(PRInt32 when, nsIFile *inDirSpec)
rv = mNativeComponentLoader->AutoRegisterComponents((PRInt32)when, dir);
if (NS_FAILED(rv)) return rv;
#ifdef ENABLE_STATIC_COMPONENT_LOADER
rv = mStaticComponentLoader->AutoRegisterComponents((PRInt32)when, dir);
if (NS_FAILED(rv)) return rv;
#endif
/* do InterfaceInfoManager after native loader so it can use components. */
rv = iim->AutoRegisterInterfaces();
if (NS_FAILED(rv)) return rv;