зеркало из https://github.com/mozilla/gecko-dev.git
Changes for RDF component registration using nsRepository. Also changed args to NSGetFactory and friends.
This commit is contained in:
Родитель
b9d95f9ba2
Коммит
44cae3cd3f
|
@ -27,7 +27,7 @@ PRInt32 gLockCount = 0;
|
|||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char* path)
|
||||
NSRegisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult ret;
|
||||
|
||||
|
@ -41,7 +41,7 @@ NSRegisterSelf(const char* path)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char* path)
|
||||
NSUnregisterSelf(nsISupports* aServMgr, const char* path)
|
||||
{
|
||||
nsresult ret;
|
||||
|
||||
|
@ -54,7 +54,11 @@ NSUnregisterSelf(const char* path)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID& aClass, nsISupports* aServMgr, nsIFactory** aFactory)
|
||||
NSGetFactory(nsISupports* aServMgr,
|
||||
const nsCID& aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory** aFactory)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
@ -78,3 +82,9 @@ NSGetFactory(const nsCID& aClass, nsISupports* aServMgr, nsIFactory** aFactory)
|
|||
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PR_FALSE; // XXX can we unload this?
|
||||
}
|
||||
|
|
|
@ -40,7 +40,11 @@ nsIFactory *nsCCapsManagerFactory::m_pNSIFactory = NULL;
|
|||
+++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* servMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
|
||||
if (!aClass.Equals(kCCapsManagerCID)) {
|
||||
|
@ -55,7 +59,7 @@ NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -134,8 +138,8 @@ nsCCapsManagerFactory::nsCCapsManagerFactory(void)
|
|||
if ( (err == NS_OK) && (m_pNSIFactory != NULL) )
|
||||
{
|
||||
NS_DEFINE_CID(kCCapsManagerCID, NS_CCAPSMANAGER_CID);
|
||||
nsRepository::RegisterFactory(kCCapsManagerCID, m_pNSIFactory,
|
||||
PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCCapsManagerCID, 0, 0,
|
||||
m_pNSIFactory, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -666,9 +666,19 @@ nsresult nsDOMFactory::LockFactory(PRBool aLock)
|
|||
|
||||
// return the proper factory to the caller
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_DOM nsresult NSGetFactory_DOM_DLL(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_DOM nsresult
|
||||
NSGetFactory_DOM_DLL(nsISupports* servMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_DOM nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory )
|
||||
extern "C" NS_DOM nsresult
|
||||
NSGetFactory(nsISupports* servMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
|
|
|
@ -131,8 +131,10 @@ PRMonitor *getEditorMonitor() //if more than one person asks for the monitor at
|
|||
we must be good providers of factories ect. this is where to put ALL editor exports
|
||||
*/
|
||||
//BEGIN EXPORTS
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID & aClass,
|
||||
nsISupports * aServiceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports * aServiceMgr,
|
||||
const nsCID & aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory ** aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
|
@ -153,7 +155,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID & aClass,
|
|||
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return nsEditor::gInstanceCount; //I have no idea. I am copying code here
|
||||
}
|
||||
|
@ -161,14 +163,14 @@ NSCanUnload(void)
|
|||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char *path)
|
||||
NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::RegisterFactory(kIEditFactoryIID, path,
|
||||
PR_TRUE, PR_TRUE); //this will register the factory with the xpcom dll.
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char *path)
|
||||
NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::UnregisterFactory(kIEditFactoryIID, path);//this will unregister the factory with the xpcom dll.
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
nsCOMPtr<nsITransactionManager> mTxnMgr;
|
||||
|
||||
|
||||
friend PRBool NSCanUnload(void);
|
||||
friend PRBool NSCanUnload(nsISupports* serviceMgr);
|
||||
static PRInt32 gInstanceCount;
|
||||
|
||||
public:
|
||||
|
|
|
@ -131,8 +131,10 @@ PRMonitor *getEditorMonitor() //if more than one person asks for the monitor at
|
|||
we must be good providers of factories ect. this is where to put ALL editor exports
|
||||
*/
|
||||
//BEGIN EXPORTS
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID & aClass,
|
||||
nsISupports * aServiceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports * aServiceMgr,
|
||||
const nsCID & aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory ** aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
|
@ -153,7 +155,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID & aClass,
|
|||
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return nsEditor::gInstanceCount; //I have no idea. I am copying code here
|
||||
}
|
||||
|
@ -161,14 +163,14 @@ NSCanUnload(void)
|
|||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char *path)
|
||||
NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::RegisterFactory(kIEditFactoryIID, path,
|
||||
PR_TRUE, PR_TRUE); //this will register the factory with the xpcom dll.
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char *path)
|
||||
NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::UnregisterFactory(kIEditFactoryIID, path);//this will unregister the factory with the xpcom dll.
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ private:
|
|||
nsCOMPtr<nsITransactionManager> mTxnMgr;
|
||||
|
||||
|
||||
friend PRBool NSCanUnload(void);
|
||||
friend PRBool NSCanUnload(nsISupports* serviceMgr);
|
||||
static PRInt32 gInstanceCount;
|
||||
|
||||
public:
|
||||
|
|
|
@ -113,8 +113,11 @@ nsresult nsTransactionManagerFactory::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory
|
||||
**aFactory)
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (!aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -129,13 +132,13 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsISupports* ser
|
|||
return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::RegisterFactory(kCTransactionManagerFactoryCID, path,
|
||||
PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::UnregisterFactory(kCTransactionManagerFactoryCID, path);
|
||||
}
|
||||
|
|
|
@ -178,7 +178,11 @@ nsresult nsGfxFactoryGTK::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_GFXNONXP nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_GFXNONXP nsresult NSGetFactory(nsISupports* servMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -175,9 +175,17 @@ nsresult nsGfxFactoryMac::LockFactory(PRBool aLock)
|
|||
|
||||
// return the proper factory to the caller
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_GFX nsresult NSGetFactory_GFXWIN_DLL(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_GFX nsresult NSGetFactory_GFXWIN_DLL(nsISupports* servMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_GFX nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_GFX nsresult NSGetFactory(nsISupports* servMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
|
|
|
@ -161,7 +161,11 @@ nsresult nsGfxFactoryMotif::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_GFXNONXP nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_GFXNONXP nsresult NSGetFactory(nsISupports* servMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -197,7 +197,11 @@ nsresult nsGfxFactoryWin::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_GFXNONXP nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_GFXNONXP nsresult NSGetFactory(nsISupports* servMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -167,9 +167,19 @@ nsresult nsParserFactory::LockFactory(PRBool aLock)
|
|||
|
||||
// return the proper factory to the caller
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory_PARSER_DLL(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory_PARSER_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
|
|
|
@ -47,9 +47,15 @@ NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
|
|||
NS_DEFINE_CID(kCollationCID, NS_COLLATION_CID);
|
||||
NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsIFactory* factoryInstance;
|
||||
|
|
|
@ -49,7 +49,10 @@ NS_DEFINE_CID(kCollationCID, NS_COLLATION_CID);
|
|||
NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsIFactory* factoryInstance;
|
||||
|
|
|
@ -50,7 +50,10 @@ NS_DEFINE_CID(kCollationFactoryCID, NS_COLLATIONFACTORY_CID);
|
|||
NS_DEFINE_CID(kCollationCID, NS_COLLATION_CID);
|
||||
NS_DEFINE_CID(kDateTimeFormatCID, NS_DATETIMEFORMAT_CID);
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsIFactory* factoryInstance;
|
||||
|
@ -61,7 +64,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
//
|
||||
// first check for the nsILocaleFactory interfaces
|
||||
//
|
||||
if (aCID.Equals(kLocaleFactoryCID))
|
||||
if (aClass.Equals(kLocaleFactoryCID))
|
||||
{
|
||||
factoryInstance = new nsLocaleFactory();
|
||||
res = factoryInstance->QueryInterface(kILocaleFactoryIID, (void **) aFactory);
|
||||
|
@ -78,7 +81,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
//
|
||||
// okay about bout nsIWin32LocaleManager
|
||||
//
|
||||
if (aCID.Equals(kWin32LocaleFactoryCID))
|
||||
if (aClass.Equals(kWin32LocaleFactoryCID))
|
||||
{
|
||||
factoryInstance = new nsIWin32LocaleFactory();
|
||||
res = factoryInstance->QueryInterface(kIFactoryIID,(void**)aFactory);
|
||||
|
@ -93,7 +96,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
//
|
||||
// let the nsLocaleFactoryWin logic take over from here
|
||||
//
|
||||
factoryInstance = new nsLocaleWinFactory(aCID);
|
||||
factoryInstance = new nsLocaleWinFactory(aClass);
|
||||
|
||||
if(NULL == factoryInstance)
|
||||
{
|
||||
|
@ -110,7 +113,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
@ -152,7 +155,7 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
|
|
@ -79,13 +79,16 @@ nsresult nsLWBrkFactory::CreateInstance(nsISupports *aDelegate,
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aFactory == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aCID.Equals(kLWBrkCID)) {
|
||||
if (aClass.Equals(kLWBrkCID)) {
|
||||
nsLWBrkFactory *factory = new nsLWBrkFactory();
|
||||
nsresult res = factory->QueryInterface(kFactoryIID, (void **) aFactory);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -97,17 +100,17 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload() {
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr) {
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::RegisterFactory(kLWBrkCID, path,
|
||||
PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::UnregisterFactory(kLWBrkCID, path);
|
||||
}
|
||||
|
|
|
@ -208,7 +208,7 @@ nsStringBundleServiceFactory::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char* path)
|
||||
NSRegisterSelf(nsISupports* serviceMgr, const char* path)
|
||||
{
|
||||
nsresult ret;
|
||||
|
||||
|
@ -222,7 +222,7 @@ NSRegisterSelf(const char* path)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char* path)
|
||||
NSUnregisterSelf(nsISupports* serviceMgr, const char* path)
|
||||
{
|
||||
nsresult ret;
|
||||
|
||||
|
@ -235,7 +235,11 @@ NSUnregisterSelf(const char* path)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID& aClass, nsISupports* aServMgr, nsIFactory** aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
|
|
@ -36,18 +36,21 @@ extern "C" PRInt32 g_LockCount = 0;
|
|||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload()
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aFactory == NULL) return NS_ERROR_NULL_POINTER;
|
||||
|
||||
// the converter manager
|
||||
if (aCID.Equals(kCharsetConverterManagerCID)) {
|
||||
if (aClass.Equals(kCharsetConverterManagerCID)) {
|
||||
nsManagerFactory *factory = new nsManagerFactory();
|
||||
nsresult res = factory->QueryInterface(kIFactoryIID, (void **) aFactory);
|
||||
|
||||
|
@ -60,7 +63,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
}
|
||||
|
||||
// the Unicode Encode helper
|
||||
if (aCID.Equals(kUnicodeEncodeHelperCID)) {
|
||||
if (aClass.Equals(kUnicodeEncodeHelperCID)) {
|
||||
nsEncodeHelperFactory *factory = new nsEncodeHelperFactory();
|
||||
nsresult res = factory->QueryInterface(kIFactoryIID, (void **) aFactory);
|
||||
|
||||
|
@ -72,7 +75,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
return res;
|
||||
}
|
||||
|
||||
if (aCID.Equals(kPlatformCharsetCID)) {
|
||||
if (aClass.Equals(kPlatformCharsetCID)) {
|
||||
nsIFactory *factory = NEW_PLATFORMCHARSETFACTORY();
|
||||
nsresult res = factory->QueryInterface(kIFactoryIID, (void**) aFactory);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -86,7 +89,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
@ -103,7 +106,7 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
|
|
@ -110,13 +110,15 @@ public:
|
|||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload()
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
||||
nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aFactory == NULL) return NS_ERROR_NULL_POINTER;
|
||||
|
@ -127,7 +129,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
|||
|
||||
for (PRInt32 i=0; i<ARRAY_SIZE(g_FactoryData); i++) {
|
||||
data = &(g_FactoryData[i]);
|
||||
if (aCID.Equals(*(data->mCID))) {
|
||||
if (aClass.Equals(*(data->mCID))) {
|
||||
fac = new nsConverterFactory(data);
|
||||
res = fac->QueryInterface(kIFactoryIID, (void **) aFactory);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -142,7 +144,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
@ -155,7 +157,7 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
|
|
@ -129,13 +129,15 @@ public:
|
|||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload()
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
||||
nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aFactory == NULL) return NS_ERROR_NULL_POINTER;
|
||||
|
@ -146,7 +148,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
|||
|
||||
for (PRInt32 i=0; i<ARRAY_SIZE(g_FactoryData); i++) {
|
||||
data = &(g_FactoryData[i]);
|
||||
if (aCID.Equals(*(data->mCID))) {
|
||||
if (aClass.Equals(*(data->mCID))) {
|
||||
fac = new nsConverterFactory(data);
|
||||
res = fac->QueryInterface(kIFactoryIID, (void **) aFactory);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -161,7 +163,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
@ -174,7 +176,7 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
|
|
@ -133,13 +133,15 @@ public:
|
|||
|
||||
NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload()
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
||||
nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aFactory == NULL) return NS_ERROR_NULL_POINTER;
|
||||
|
@ -150,7 +152,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
|||
|
||||
for (PRInt32 i=0; i<ARRAY_SIZE(g_FactoryData); i++) {
|
||||
data = &(g_FactoryData[i]);
|
||||
if (aCID.Equals(*(data->mCID))) {
|
||||
if (aClass.Equals(*(data->mCID))) {
|
||||
fac = new nsConverterFactory(data);
|
||||
res = fac->QueryInterface(kIFactoryIID, (void **) aFactory);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -165,7 +167,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
@ -178,7 +180,7 @@ extern "C" NS_EXPORT nsresult NSRegisterSelf(const char * path)
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char * path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char * path)
|
||||
{
|
||||
nsresult res;
|
||||
|
||||
|
|
|
@ -82,13 +82,16 @@ nsresult nsUnicharUtilFactory::CreateInstance(nsISupports *aDelegate,
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aFactory == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aCID.Equals(kUnicharUtilCID)) {
|
||||
if (aClass.Equals(kUnicharUtilCID)) {
|
||||
nsUnicharUtilFactory *factory = new nsUnicharUtilFactory();
|
||||
nsresult res = factory->QueryInterface(kFactoryIID, (void **) aFactory);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -100,16 +103,16 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload() {
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr) {
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::RegisterFactory(kUnicharUtilCID, path,
|
||||
PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::UnregisterFactory(kUnicharUtilCID, path);
|
||||
}
|
||||
|
|
|
@ -47,7 +47,11 @@ nsCLiveconnect *nsCLiveconnectFactory::m_pNSCLiveconnect = NULL;
|
|||
+++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
|
||||
if (!aClass.Equals(kCLiveconnectCID)) {
|
||||
|
@ -62,7 +66,7 @@ NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
@ -149,8 +153,8 @@ nsCLiveconnectFactory::nsCLiveconnectFactory(void)
|
|||
if ( (err == NS_OK) && (m_pNSIFactory != NULL) )
|
||||
{
|
||||
NS_DEFINE_CID(kCLiveconnectCID, NS_CLIVECONNECT_CID);
|
||||
nsRepository::RegisterFactory(kCLiveconnectCID, m_pNSIFactory,
|
||||
PR_FALSE);
|
||||
nsRepository::RegisterFactory(kCLiveconnectCID, NULL, NULL,
|
||||
m_pNSIFactory, PR_FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -373,9 +373,19 @@ static ScriptNameSetRegistryHolder gManager;
|
|||
|
||||
// return the proper factory to the caller
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_LAYOUT nsresult NSGetFactory_LAYOUT_DLL(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory )
|
||||
extern "C" NS_LAYOUT nsresult
|
||||
NSGetFactory_LAYOUT_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_LAYOUT nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_LAYOUT nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == ScriptNameSetRegistryHolder::gRegistry) {
|
||||
|
|
|
@ -583,12 +583,17 @@ nsresult nsPrefFactory::CreateInstance(nsISupports *aDelegate,
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* serviceMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aFactory == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aCID.Equals(kPrefCID)) {
|
||||
if (aClass.Equals(kPrefCID)) {
|
||||
nsPrefFactory *factory = new nsPrefFactory();
|
||||
nsresult res = factory->QueryInterface(kFactoryIID, (void **) aFactory);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -600,18 +605,18 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* servi
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload()
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PRBool(g_InstanceCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::RegisterComponent(kPrefCID, NULL, NULL, path,
|
||||
PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::UnregisterFactory(kPrefCID, path);
|
||||
}
|
||||
|
|
|
@ -41,7 +41,11 @@ nsIServiceManager *g_pNSIServiceManager = NULL;
|
|||
+++++++++++++++++++++++++++++++++++++++++++++++++*/
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsresult res = NS_OK;
|
||||
if (!aClass.Equals(kCJVMManagerCID)) {
|
||||
|
@ -50,9 +54,9 @@ NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
|||
nsCJVMManagerFactory* factory = new nsCJVMManagerFactory();
|
||||
if (factory == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
factory->AddRef();
|
||||
NS_ADDREF(factory);
|
||||
*aFactory = factory;
|
||||
res = servMgr->QueryInterface(kIServiceManagerIID, (void**)&g_pNSIServiceManager);
|
||||
res = serviceMgr->QueryInterface(kIServiceManagerIID, (void**)&g_pNSIServiceManager);
|
||||
if ((NS_OK == res) && (nsnull != g_pNSIServiceManager))
|
||||
{
|
||||
return NS_OK;
|
||||
|
@ -61,7 +65,7 @@ NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PR_FALSE;
|
||||
}
|
||||
|
|
|
@ -97,8 +97,10 @@
|
|||
* by calling nsIPlugin::CreateInstance.
|
||||
*/
|
||||
// (Declared in nsRepository.h)
|
||||
//extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass,
|
||||
// nsISupports* serviceMgr,
|
||||
//extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
// const nsCID &aClass,
|
||||
// const char *aClassName,
|
||||
// const char *aProgID,
|
||||
// nsIFactory **aFactory);
|
||||
|
||||
/**
|
||||
|
|
|
@ -147,7 +147,12 @@ nsresult nsPluginFactory :: LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_PLUGIN nsresult NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory )
|
||||
extern "C" NS_PLUGIN nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
@ -1770,7 +1770,7 @@ NS_IMETHODIMP nsPluginHostImpl :: SetUpPluginInstance(const char *aMimeType,
|
|||
nsFactoryProc fact = (nsFactoryProc)PR_FindSymbol(plugins->mLibrary, "NSGetFactory");
|
||||
|
||||
if (nsnull != fact)
|
||||
(fact)(kIPluginIID, mServiceMgr, (nsIFactory**)&plugins->mEntryPoint);
|
||||
(fact)(mServiceMgr, kIPluginIID, 0, 0, (nsIFactory**)&plugins->mEntryPoint);
|
||||
|
||||
// we only need to call this for 5x style plugins - CreatePlugin() handles this for
|
||||
// 4x style plugins
|
||||
|
@ -1837,7 +1837,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi
|
|||
// need to get the plugin factory from this plugin.
|
||||
nsFactoryProc nsGetFactory = (nsFactoryProc) PR_FindSymbol(pluginTag->mLibrary, "NSGetFactory");
|
||||
if (nsGetFactory != NULL) {
|
||||
res = nsGetFactory(kIPluginIID, mServiceMgr, (nsIFactory**)&pluginTag->mEntryPoint);
|
||||
res = nsGetFactory(mServiceMgr, kIPluginIID, nsnull, nsnull, // XXX fix ClassName/ProgID
|
||||
(nsIFactory**)&pluginTag->mEntryPoint);
|
||||
plugin = pluginTag->mEntryPoint;
|
||||
if (plugin != NULL)
|
||||
plugin->Initialize();
|
||||
|
|
|
@ -147,7 +147,12 @@ nsresult nsPluginFactory :: LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_PLUGIN nsresult NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory )
|
||||
extern "C" NS_PLUGIN nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
@ -1770,7 +1770,7 @@ NS_IMETHODIMP nsPluginHostImpl :: SetUpPluginInstance(const char *aMimeType,
|
|||
nsFactoryProc fact = (nsFactoryProc)PR_FindSymbol(plugins->mLibrary, "NSGetFactory");
|
||||
|
||||
if (nsnull != fact)
|
||||
(fact)(kIPluginIID, mServiceMgr, (nsIFactory**)&plugins->mEntryPoint);
|
||||
(fact)(mServiceMgr, kIPluginIID, 0, 0, (nsIFactory**)&plugins->mEntryPoint);
|
||||
|
||||
// we only need to call this for 5x style plugins - CreatePlugin() handles this for
|
||||
// 4x style plugins
|
||||
|
@ -1837,7 +1837,8 @@ NS_IMETHODIMP nsPluginHostImpl::GetPluginFactory(const char *aMimeType, nsIPlugi
|
|||
// need to get the plugin factory from this plugin.
|
||||
nsFactoryProc nsGetFactory = (nsFactoryProc) PR_FindSymbol(pluginTag->mLibrary, "NSGetFactory");
|
||||
if (nsGetFactory != NULL) {
|
||||
res = nsGetFactory(kIPluginIID, mServiceMgr, (nsIFactory**)&pluginTag->mEntryPoint);
|
||||
res = nsGetFactory(mServiceMgr, kIPluginIID, nsnull, nsnull, // XXX fix ClassName/ProgID
|
||||
(nsIFactory**)&pluginTag->mEntryPoint);
|
||||
plugin = pluginTag->mEntryPoint;
|
||||
if (plugin != NULL)
|
||||
plugin->Initialize();
|
||||
|
|
|
@ -97,8 +97,10 @@
|
|||
* by calling nsIPlugin::CreateInstance.
|
||||
*/
|
||||
// (Declared in nsRepository.h)
|
||||
//extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass,
|
||||
// nsISupports* serviceMgr,
|
||||
//extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
// const nsCID &aClass,
|
||||
// const char *aClassName,
|
||||
// const char *aProgID,
|
||||
// nsIFactory **aFactory);
|
||||
|
||||
/**
|
||||
|
|
|
@ -508,7 +508,11 @@ NS_IMPL_RELEASE(SimplePlugin);
|
|||
SimplePlugin* gPlugin = NULL;
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aClass.Equals(kIPluginIID)) {
|
||||
if (gPlugin) {
|
||||
|
@ -528,7 +532,7 @@ NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return gPluginObjectCount == 1 && !gPluginLocked;
|
||||
}
|
||||
|
|
|
@ -508,7 +508,11 @@ NS_IMPL_RELEASE(SimplePlugin);
|
|||
SimplePlugin* gPlugin = NULL;
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aClass.Equals(kIPluginIID)) {
|
||||
if (gPlugin) {
|
||||
|
@ -528,7 +532,7 @@ NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return gPluginObjectCount == 1 && !gPluginLocked;
|
||||
}
|
||||
|
|
|
@ -147,9 +147,19 @@ nsresult nsNetFactory::LockFactory(PRBool aLock)
|
|||
|
||||
// return the proper factory to the caller
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_NET nsresult NSGetFactory_NETLIB_DLL(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_NET nsresult
|
||||
NSGetFactory_NETLIB_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_NET nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_NET nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
|
|
|
@ -167,9 +167,19 @@ nsresult nsParserFactory::LockFactory(PRBool aLock)
|
|||
|
||||
// return the proper factory to the caller
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory_PARSER_DLL(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory_PARSER_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
|
|
|
@ -57,6 +57,12 @@ class NS_RDF nsIRDFNode : public nsISupports {
|
|||
public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IRDFNODE_IID; return iid; }
|
||||
|
||||
/**
|
||||
* Called by nsIRDFService after constructing a resource object to
|
||||
* initialize it's URI.
|
||||
*/
|
||||
NS_IMETHOD Init(const char* uri) = 0;
|
||||
|
||||
/**
|
||||
* Determine if two nodes are identical
|
||||
*/
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#ifndef nsIRDFResourceFactory_h__
|
||||
#define nsIRDFResourceFactory_h__
|
||||
|
||||
#if 0 // obsolete
|
||||
|
||||
#include "nsISupports.h"
|
||||
class nsIRDFResource;
|
||||
|
||||
|
@ -69,6 +71,7 @@ public:
|
|||
NS_IMETHOD CreateResource(const char* aURI, nsIRDFResource** aResult) = 0;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
#endif // nsIRDFResourceFactory_h__
|
||||
|
||||
|
|
|
@ -41,9 +41,6 @@ class nsIRDFDataBase;
|
|||
class nsIRDFDataSource;
|
||||
class nsIRDFLiteral;
|
||||
class nsIRDFResource;
|
||||
class nsIRDFResourceFactory;
|
||||
|
||||
typedef nsresult (*NSDataSourceConstructorCallback)(nsIRDFDataSource** aResult);
|
||||
|
||||
// {BFD05261-834C-11d2-8EAC-00805F29F370}
|
||||
#define NS_IRDFSERVICE_IID \
|
||||
|
@ -76,6 +73,11 @@ public:
|
|||
*/
|
||||
NS_IMETHOD GetLiteral(const PRUnichar* value, nsIRDFLiteral** literal) = 0;
|
||||
|
||||
/**
|
||||
* Registers a resource with the RDF system, making it unique w.r.t. GetResource.
|
||||
*/
|
||||
NS_IMETHOD RegisterResource(nsIRDFResource* aResource, PRBool replace = PR_FALSE) = 0;
|
||||
|
||||
/**
|
||||
* Called to notify the resource manager that a resource is no
|
||||
* longer in use. This method should only be called from the
|
||||
|
@ -89,20 +91,7 @@ public:
|
|||
* reason, you must always un-cache the resource <b>before</b>
|
||||
* releasing the storage for the <tt>const char*</tt> URI.
|
||||
*/
|
||||
NS_IMETHOD UnCacheResource(nsIRDFResource* resource) = 0;
|
||||
|
||||
/**
|
||||
* Registers the specified resource factory as the producer for resources that
|
||||
* have the specified <i>URI prefix</i>.
|
||||
*/
|
||||
NS_IMETHOD RegisterResourceFactory(const char* aURIPrefix, nsIRDFResourceFactory* aFactory) = 0;
|
||||
|
||||
/**
|
||||
* Unregsters the specified resource factory from producing resources that have
|
||||
* the specified <i>URI prefix</i>.
|
||||
*/
|
||||
NS_IMETHOD UnRegisterResourceFactory(const char* aURIPrefix) = 0;
|
||||
|
||||
NS_IMETHOD UnregisterResource(nsIRDFResource* aResource) = 0;
|
||||
|
||||
// Data source management routines
|
||||
|
||||
|
@ -117,7 +106,8 @@ public:
|
|||
* and unregisters when the last reference to the data source is
|
||||
* released.
|
||||
*/
|
||||
NS_IMETHOD RegisterDataSource(nsIRDFDataSource* dataSource) = 0;
|
||||
NS_IMETHOD RegisterDataSource(nsIRDFDataSource* dataSource,
|
||||
PRBool replace = PR_FALSE) = 0;
|
||||
|
||||
/**
|
||||
* Unregister a <i>named data source</i>. The RDF service will call
|
||||
|
@ -126,18 +116,6 @@ public:
|
|||
*/
|
||||
NS_IMETHOD UnregisterDataSource(nsIRDFDataSource* dataSource) = 0;
|
||||
|
||||
/**
|
||||
* Register a constructor function that will create a named data source.
|
||||
* The RDF service will call this function to attempt to create a
|
||||
* named data source.
|
||||
*/
|
||||
NS_IMETHOD RegisterDataSourceConstructor(const char* aURI, NSDataSourceConstructorCallback aFn) = 0;
|
||||
|
||||
/**
|
||||
* Unregister the constructor function for a named data source.
|
||||
*/
|
||||
NS_IMETHOD UnregisterDataSourceConstructor(const char* aURI) = 0;
|
||||
|
||||
/**
|
||||
* Get the <i>named data source</i> corresponding to the URI. If a data
|
||||
* source has been registered via <tt>RegisterDataSource()</tt>, that
|
||||
|
|
|
@ -66,6 +66,13 @@ static const char* kTag##prefix##_##name = #name
|
|||
#define NS_ERROR_RDF_CURSOR_EMPTY NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_RDF, 1)
|
||||
#define NS_ERROR_RDF_NO_VALUE NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_RDF, 2)
|
||||
|
||||
/* ProgID prefixes for RDF DLL registration. */
|
||||
#define NS_RDF_PROGID "component:||netscape|rdf"
|
||||
#define NS_RDF_DATASOURCE_PROGID NS_RDF_PROGID "|datasource"
|
||||
#define NS_RDF_DATASOURCE_PROGID_PREFIX NS_RDF_DATASOURCE_PROGID "?name="
|
||||
#define NS_RDF_RESOURCE_FACTORY_PROGID "component:||netscape|rdf|resource-factory"
|
||||
#define NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX NS_RDF_RESOURCE_FACTORY_PROGID "?name="
|
||||
|
||||
/*@}*/
|
||||
|
||||
#ifdef _IMPL_NS_RDF
|
||||
|
|
|
@ -24,9 +24,12 @@
|
|||
|
||||
*/
|
||||
|
||||
#include "nsIRDFResourceFactory.h"
|
||||
#include "nsRDFResource.h"
|
||||
|
||||
#if 0
|
||||
|
||||
#include "nsIRDFResourceFactory.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class DefaultResourceFactoryImpl : public nsIRDFResourceFactory
|
||||
|
@ -88,3 +91,21 @@ NS_NewRDFDefaultResourceFactory(nsIRDFResourceFactory** result)
|
|||
*result = factory;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
nsresult
|
||||
NS_NewDefaultResource(nsIRDFResource** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsRDFResource* resource = new nsRDFResource();
|
||||
if (! resource)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(resource);
|
||||
*aResult = resource;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -23,17 +23,7 @@
|
|||
TO DO
|
||||
-----
|
||||
|
||||
1) Figure out a better way to do "pluggable resources." Currently,
|
||||
we have two _major_ hacks:
|
||||
|
||||
RegisterBuiltInNamedDataSources()
|
||||
RegisterBuiltInResourceFactories()
|
||||
|
||||
These introduce dependencies on the datasource directory. You'd
|
||||
like to have this stuff discovered dynamically at startup or
|
||||
something. Maybe from the registry.
|
||||
|
||||
2) Implement the CreateDataBase() methods.
|
||||
1) Implement the CreateDataBase() methods.
|
||||
|
||||
*/
|
||||
|
||||
|
@ -43,8 +33,10 @@
|
|||
#include "nsIRDFService.h"
|
||||
#include "nsIRDFResourceFactory.h"
|
||||
#include "nsString.h"
|
||||
#include "nsRepository.h"
|
||||
#include "plhash.h"
|
||||
#include "plstr.h"
|
||||
#include "prprf.h"
|
||||
#include "prlog.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
@ -221,6 +213,7 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRDFNode
|
||||
NS_IMETHOD Init(const char* uri);
|
||||
NS_IMETHOD EqualsNode(nsIRDFNode* node, PRBool* result) const;
|
||||
|
||||
// nsIRDFLiteral
|
||||
|
@ -262,6 +255,15 @@ LiteralImpl::QueryInterface(REFNSIID iid, void** result)
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LiteralImpl::Init(const char* uri)
|
||||
{
|
||||
// Literals should always be constructed by calling nsIRDFService::GetLiteral,
|
||||
// so this method should never get called.
|
||||
NS_NOTREACHED("RDF LiteralImpl::Init");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
LiteralImpl::EqualsNode(nsIRDFNode* node, PRBool* result) const
|
||||
{
|
||||
|
@ -318,7 +320,6 @@ class ServiceImpl : public nsIRDFService
|
|||
protected:
|
||||
PrefixMap mResourceFactories;
|
||||
PLHashTable* mNamedDataSources;
|
||||
PLHashTable* mDataSourceConstructors;
|
||||
PLHashTable* mResources;
|
||||
|
||||
ServiceImpl(void);
|
||||
|
@ -326,9 +327,6 @@ protected:
|
|||
|
||||
static nsIRDFService* gRDFService; // The one-and-only RDF service
|
||||
|
||||
static void RegisterBuiltInResourceFactories();
|
||||
static void RegisterBuiltInNamedDataSources();
|
||||
|
||||
public:
|
||||
|
||||
static nsresult GetRDFService(nsIRDFService** result);
|
||||
|
@ -340,15 +338,10 @@ public:
|
|||
NS_IMETHOD GetResource(const char* uri, nsIRDFResource** resource);
|
||||
NS_IMETHOD GetUnicodeResource(const PRUnichar* uri, nsIRDFResource** resource);
|
||||
NS_IMETHOD GetLiteral(const PRUnichar* value, nsIRDFLiteral** literal);
|
||||
NS_IMETHOD UnCacheResource(nsIRDFResource* resource);
|
||||
|
||||
NS_IMETHOD RegisterResourceFactory(const char* aURIPrefix, nsIRDFResourceFactory* aFactory);
|
||||
NS_IMETHOD UnRegisterResourceFactory(const char* aURIPrefix);
|
||||
|
||||
NS_IMETHOD RegisterDataSource(nsIRDFDataSource* dataSource);
|
||||
NS_IMETHOD RegisterResource(nsIRDFResource* aResource, PRBool replace = PR_FALSE);
|
||||
NS_IMETHOD UnregisterResource(nsIRDFResource* aResource);
|
||||
NS_IMETHOD RegisterDataSource(nsIRDFDataSource* dataSource, PRBool replace = PR_FALSE);
|
||||
NS_IMETHOD UnregisterDataSource(nsIRDFDataSource* dataSource);
|
||||
NS_IMETHOD RegisterDataSourceConstructor(const char* uri, NSDataSourceConstructorCallback fn);
|
||||
NS_IMETHOD UnregisterDataSourceConstructor(const char* uri);
|
||||
NS_IMETHOD GetDataSource(const char* uri, nsIRDFDataSource** dataSource);
|
||||
NS_IMETHOD CreateDatabase(const char** uris, nsIRDFDataBase** dataBase);
|
||||
NS_IMETHOD CreateBrowserDatabase(nsIRDFDataBase** dataBase);
|
||||
|
@ -373,21 +366,11 @@ ServiceImpl::ServiceImpl(void)
|
|||
PL_CompareStrings,
|
||||
PL_CompareValues,
|
||||
nsnull, nsnull);
|
||||
|
||||
mDataSourceConstructors = PL_NewHashTable(23,
|
||||
PL_HashString,
|
||||
PL_CompareStrings,
|
||||
PL_CompareValues,
|
||||
nsnull, nsnull);
|
||||
}
|
||||
|
||||
|
||||
ServiceImpl::~ServiceImpl(void)
|
||||
{
|
||||
if (mDataSourceConstructors) {
|
||||
PL_HashTableDestroy(mDataSourceConstructors);
|
||||
mDataSourceConstructors = nsnull;
|
||||
}
|
||||
if (mNamedDataSources) {
|
||||
PL_HashTableDestroy(mNamedDataSources);
|
||||
mNamedDataSources = nsnull;
|
||||
|
@ -403,13 +386,12 @@ ServiceImpl::~ServiceImpl(void)
|
|||
nsresult
|
||||
ServiceImpl::GetRDFService(nsIRDFService** mgr)
|
||||
{
|
||||
nsresult rv;
|
||||
if (! gRDFService) {
|
||||
gRDFService = new ServiceImpl();
|
||||
if (! gRDFService)
|
||||
ServiceImpl* serv = new ServiceImpl();
|
||||
if (! serv)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
RegisterBuiltInResourceFactories();
|
||||
RegisterBuiltInNamedDataSources();
|
||||
gRDFService = serv;
|
||||
}
|
||||
|
||||
NS_ADDREF(gRDFService);
|
||||
|
@ -441,42 +423,53 @@ ServiceImpl::GetResource(const char* uri, nsIRDFResource** resource)
|
|||
nsIRDFResource* result =
|
||||
NS_STATIC_CAST(nsIRDFResource*, PL_HashTableLookup(mResources, uri));
|
||||
|
||||
if (! result) {
|
||||
nsIRDFResourceFactory* factory =
|
||||
NS_STATIC_CAST(nsIRDFResourceFactory*,
|
||||
NS_CONST_CAST(void*, mResourceFactories.Find(uri)));
|
||||
|
||||
PR_ASSERT(factory != nsnull);
|
||||
if (! factory)
|
||||
return NS_ERROR_FAILURE; // XXX
|
||||
|
||||
nsresult rv;
|
||||
|
||||
if (NS_FAILED(rv = factory->CreateResource(uri, &result)))
|
||||
return rv;
|
||||
|
||||
const char* uri;
|
||||
result->GetValue(&uri);
|
||||
|
||||
// This is a little trick to make storage more efficient. For
|
||||
// the "key" in the table, we'll use the string value that's
|
||||
// stored as a member variable of the nsIRDFResource object.
|
||||
PL_HashTableAdd(mResources, uri, result);
|
||||
|
||||
// *We* don't AddRef() the resource: that way, the resource
|
||||
// can be garbage collected when the last refcount goes
|
||||
// away. The single addref that the CreateResource() call made
|
||||
// will be owned by the callee.
|
||||
}
|
||||
else {
|
||||
if (result) {
|
||||
// Addref for the callee.
|
||||
NS_ADDREF(result);
|
||||
}
|
||||
|
||||
*resource = result;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
nsAutoString uriStr = uri;
|
||||
PRInt32 pos = uriStr.Find(':');
|
||||
if (pos < 0) {
|
||||
// no colon, so try the default resource factory
|
||||
rv = nsRepository::CreateInstance(NS_RDF_RESOURCE_FACTORY_PROGID,
|
||||
nsnull, nsIRDFResource::IID(),
|
||||
(void**)&result);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
else {
|
||||
nsAutoString prefix;
|
||||
uriStr.Left(prefix, pos); // truncate
|
||||
char* prefixStr = prefix.ToNewCString();
|
||||
if (prefixStr == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
char* progID = PR_smprintf(NS_RDF_RESOURCE_FACTORY_PROGID_PREFIX "%s",
|
||||
prefixStr);
|
||||
delete[] prefixStr;
|
||||
if (progID == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = nsRepository::CreateInstance(progID, nsnull,
|
||||
nsIRDFResource::IID(),
|
||||
(void**)&result);
|
||||
PR_smprintf_free(progID);
|
||||
if (NS_FAILED(rv)) {
|
||||
// if we failed, try the default resource factory
|
||||
rv = nsRepository::CreateInstance(NS_RDF_RESOURCE_FACTORY_PROGID,
|
||||
nsnull, nsIRDFResource::IID(),
|
||||
(void**)&result);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
}
|
||||
rv = result->Init(uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
*resource = result;
|
||||
return RegisterResource(result);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceImpl::GetUnicodeResource(const PRUnichar* uri, nsIRDFResource** resource)
|
||||
|
@ -502,7 +495,41 @@ ServiceImpl::GetLiteral(const PRUnichar* uri, nsIRDFLiteral** literal)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceImpl::UnCacheResource(nsIRDFResource* resource)
|
||||
ServiceImpl::RegisterResource(nsIRDFResource* aResource, PRBool replace)
|
||||
{
|
||||
NS_PRECONDITION(aResource != nsnull, "null ptr");
|
||||
if (! aResource)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsresult rv;
|
||||
|
||||
const char* uri;
|
||||
rv = aResource->GetValue(&uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsIRDFResource* prevRes =
|
||||
NS_STATIC_CAST(nsIRDFResource*, PL_HashTableLookup(mResources, uri));
|
||||
if (prevRes != nsnull) {
|
||||
if (replace)
|
||||
NS_RELEASE(prevRes);
|
||||
else
|
||||
return NS_ERROR_FAILURE; // already registered
|
||||
}
|
||||
|
||||
// This is a little trick to make storage more efficient. For
|
||||
// the "key" in the table, we'll use the string value that's
|
||||
// stored as a member variable of the nsIRDFResource object.
|
||||
PL_HashTableAdd(mResources, uri, aResource);
|
||||
|
||||
// *We* don't AddRef() the resource: that way, the resource
|
||||
// can be garbage collected when the last refcount goes
|
||||
// away. The single addref that the CreateResource() call made
|
||||
// will be owned by the callee.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceImpl::UnregisterResource(nsIRDFResource* resource)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -515,31 +542,7 @@ ServiceImpl::UnCacheResource(nsIRDFResource* resource)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceImpl::RegisterResourceFactory(const char* aURIPrefix, nsIRDFResourceFactory* aFactory)
|
||||
{
|
||||
if (! mResourceFactories.Add(aURIPrefix, aFactory))
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
NS_ADDREF(aFactory); // XXX should we addref?
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceImpl::UnRegisterResourceFactory(const char* aURIPrefix)
|
||||
{
|
||||
nsIRDFResourceFactory* factory =
|
||||
NS_STATIC_CAST(nsIRDFResourceFactory*,
|
||||
NS_CONST_CAST(void*, mResourceFactories.Remove(aURIPrefix)));
|
||||
|
||||
if (! factory)
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
NS_RELEASE(factory); // XXX should we addref?
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource)
|
||||
ServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource, PRBool replace)
|
||||
{
|
||||
NS_PRECONDITION(aDataSource != nsnull, "null ptr");
|
||||
if (! aDataSource)
|
||||
|
@ -551,7 +554,15 @@ ServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource)
|
|||
if (NS_FAILED(rv = aDataSource->GetURI(&uri)))
|
||||
return rv;
|
||||
|
||||
// XXX check for dups, etc.
|
||||
nsIRDFDataSource* ds =
|
||||
NS_STATIC_CAST(nsIRDFDataSource*, PL_HashTableLookup(mNamedDataSources, uri));
|
||||
|
||||
if (ds) {
|
||||
if (replace)
|
||||
NS_RELEASE(ds);
|
||||
else
|
||||
return NS_ERROR_FAILURE; // already registered
|
||||
}
|
||||
|
||||
PL_HashTableAdd(mNamedDataSources, uri, aDataSource);
|
||||
return NS_OK;
|
||||
|
@ -580,21 +591,6 @@ ServiceImpl::UnregisterDataSource(nsIRDFDataSource* aDataSource)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceImpl::RegisterDataSourceConstructor(const char* uri, NSDataSourceConstructorCallback fn)
|
||||
{
|
||||
// XXX check for dups, etc.
|
||||
PL_HashTableAdd(mDataSourceConstructors, uri, fn);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceImpl::UnregisterDataSourceConstructor(const char* uri)
|
||||
{
|
||||
PL_HashTableRemove(mDataSourceConstructors, uri);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
ServiceImpl::GetDataSource(const char* uri, nsIRDFDataSource** aDataSource)
|
||||
{
|
||||
|
@ -606,41 +602,27 @@ ServiceImpl::GetDataSource(const char* uri, nsIRDFDataSource** aDataSource)
|
|||
*aDataSource = ds;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Otherwise, see if we have a lazy constructor
|
||||
NSDataSourceConstructorCallback constructor =
|
||||
(NSDataSourceConstructorCallback)
|
||||
PL_HashTableLookup(mDataSourceConstructors, uri);
|
||||
|
||||
if (constructor) {
|
||||
// Yep, so try to construct it on the fly...
|
||||
nsresult rv;
|
||||
|
||||
if (NS_FAILED(rv = constructor(&ds))) {
|
||||
#ifdef DEBUG
|
||||
printf("error constructing built-in datasource %s\n", uri);
|
||||
#endif
|
||||
return rv;
|
||||
}
|
||||
|
||||
// If it wants to register itself, it should do so in the Init() method.
|
||||
if (NS_FAILED(rv = ds->Init(uri))) {
|
||||
#ifdef DEBUG
|
||||
printf("error initializing named datasource %s\n", uri);
|
||||
#endif
|
||||
NS_RELEASE(ds);
|
||||
return rv;
|
||||
}
|
||||
|
||||
// constructor did an implicit addref
|
||||
*aDataSource = ds;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// XXX at this point, we might want to try to construct a
|
||||
// stream URI and load it that way...
|
||||
return NS_ERROR_ILLEGAL_VALUE;
|
||||
|
||||
nsAutoString dataSourceName = uri;
|
||||
PRInt32 pos = dataSourceName.Find(':');
|
||||
if (pos < 0) return NS_ERROR_FAILURE; // bad URI
|
||||
dataSourceName.Right(dataSourceName, pos + 1);
|
||||
char* name = dataSourceName.ToNewCString();
|
||||
if (name == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
char* progID = PR_smprintf(NS_RDF_DATASOURCE_PROGID_PREFIX "%s",
|
||||
name);
|
||||
delete[] name;
|
||||
if (progID == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
rv = nsRepository::CreateInstance(progID, nsnull,
|
||||
nsIRDFDataSource::IID(),
|
||||
(void**)aDataSource);
|
||||
PR_smprintf_free(progID);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
rv = (*aDataSource)->Init(uri);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return RegisterDataSource(*aDataSource);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -658,97 +640,6 @@ ServiceImpl::CreateBrowserDatabase(nsIRDFDataBase** dataBase)
|
|||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This is Big Hack #1. Depedencies on all builtin resource
|
||||
// factories are *here*, in the ResourceFactoryTable.
|
||||
//
|
||||
|
||||
struct ResourceFactoryTable {
|
||||
const char* mPrefix;
|
||||
nsresult (*mFactoryConstructor)(nsIRDFResourceFactory** result);
|
||||
};
|
||||
|
||||
void
|
||||
ServiceImpl::RegisterBuiltInResourceFactories(void)
|
||||
{
|
||||
extern nsresult NS_NewRDFDefaultResourceFactory(nsIRDFResourceFactory** result);
|
||||
// extern nsresult NS_NewRDFMailResourceFactory(nsIRDFResourceFactory** result);
|
||||
// extern nsresult NS_NewRDFMailAccountResourceFactory(nsIRDFResourceFactory** result);
|
||||
extern nsresult NS_NewRDFFileResourceFactory(nsIRDFResourceFactory** result);
|
||||
|
||||
static ResourceFactoryTable gTable[] = {
|
||||
"", NS_NewRDFDefaultResourceFactory,
|
||||
// "mailaccount:", NS_NewRDFMailAccountResourceFactory,
|
||||
// "mailbox:", NS_NewRDFMailResourceFactory,
|
||||
nsnull, nsnull
|
||||
};
|
||||
|
||||
nsresult rv;
|
||||
for (ResourceFactoryTable* entry = gTable; entry->mPrefix != nsnull; ++entry) {
|
||||
nsIRDFResourceFactory* factory;
|
||||
|
||||
if (NS_FAILED(rv = (entry->mFactoryConstructor)(&factory)))
|
||||
continue;
|
||||
|
||||
rv = gRDFService->RegisterResourceFactory(entry->mPrefix, factory);
|
||||
PR_ASSERT(NS_SUCCEEDED(rv));
|
||||
|
||||
NS_RELEASE(factory);
|
||||
}
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// This is Big Hack #2. Dependencies on all builtin datasources are
|
||||
// *here*, in the DataSourceTable.
|
||||
//
|
||||
// FWIW, I don't particularly like this interface *anyway*, because
|
||||
// it requires each built-in data source to be constructed "up
|
||||
// front". Not only does it cause the service manager to be
|
||||
// re-entered (which may be a problem), but it's wasteful: I think
|
||||
// these data sources should be created on demand, and released when
|
||||
// you're done with them.
|
||||
//
|
||||
|
||||
struct DataSourceTable {
|
||||
const char* mURI;
|
||||
nsresult (*mDataSourceConstructor)(nsIRDFDataSource** result);
|
||||
};
|
||||
|
||||
void
|
||||
ServiceImpl::RegisterBuiltInNamedDataSources(void)
|
||||
{
|
||||
extern nsresult NS_NewRDFBookmarkDataSource(nsIRDFDataSource** result);
|
||||
extern nsresult NS_NewRDFHistoryDataSource(nsIRDFDataSource** result);
|
||||
extern nsresult NS_NewRDFFileSystemDataSource(nsIRDFDataSource** result);
|
||||
// extern nsresult NS_NewRDFMailDataSource(nsIRDFDataSource** result);
|
||||
|
||||
static DataSourceTable gTable[] = {
|
||||
"rdf:bookmarks", NS_NewRDFBookmarkDataSource,
|
||||
"rdf:files", NS_NewRDFFileSystemDataSource,
|
||||
// "rdf:mail", NS_NewRDFMailDataSource,
|
||||
#if 0
|
||||
"rdf:history", NS_NewRDFHistoryDataSource,
|
||||
#endif
|
||||
nsnull, nsnull
|
||||
};
|
||||
|
||||
nsresult rv;
|
||||
for (DataSourceTable* entry = gTable; entry->mURI != nsnull; ++entry) {
|
||||
if (NS_FAILED(rv = gRDFService->RegisterDataSourceConstructor(entry->mURI, entry->mDataSourceConstructor))) {
|
||||
#ifdef DEBUG
|
||||
printf("error registering built-in datasource constructor for %s\n", entry->mURI);
|
||||
#endif
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsresult
|
||||
NS_NewRDFService(nsIRDFService** mgr)
|
||||
{
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
#define nsRDFCID_h__
|
||||
|
||||
// {0F78DA56-8321-11d2-8EAC-00805F29F370}
|
||||
#define NS_RDFNODE_CID \
|
||||
#define NS_RDFDEFAULTRESOURCE_CID \
|
||||
{ 0xf78da56, 0x8321, 0x11d2, { 0x8e, 0xac, 0x0, 0x80, 0x5f, 0x29, 0xf3, 0x70 } }
|
||||
|
||||
// {BFD05264-834C-11d2-8EAC-00805F29F370}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "nsRDFBuiltInDataSources.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsRepository.h"
|
||||
#include "rdf.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID);
|
||||
|
@ -51,11 +52,12 @@ static NS_DEFINE_CID(kRDFXULBuilderCID, NS_RDFXULBUILDER_CID);
|
|||
static NS_DEFINE_CID(kXULContentSinkCID, NS_XULCONTENTSINK_CID);
|
||||
static NS_DEFINE_CID(kXULDataSourceCID, NS_XULDATASOURCE_CID);
|
||||
static NS_DEFINE_CID(kXULDocumentCID, NS_XULDOCUMENT_CID);
|
||||
static NS_DEFINE_CID(kRDFDefaultResourceCID, NS_RDFDEFAULTRESOURCE_CID);
|
||||
|
||||
class RDFFactoryImpl : public nsIFactory
|
||||
{
|
||||
public:
|
||||
RDFFactoryImpl(const nsCID &aClass);
|
||||
RDFFactoryImpl(const nsCID &aClass, const char* className, const char* progID);
|
||||
|
||||
// nsISupports methods
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -70,16 +72,20 @@ public:
|
|||
protected:
|
||||
virtual ~RDFFactoryImpl();
|
||||
|
||||
private:
|
||||
protected:
|
||||
nsCID mClassID;
|
||||
const char* mClassName;
|
||||
const char* mProgID;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
RDFFactoryImpl::RDFFactoryImpl(const nsCID &aClass)
|
||||
RDFFactoryImpl::RDFFactoryImpl(const nsCID &aClass,
|
||||
const char* className,
|
||||
const char* progID)
|
||||
: mClassID(aClass), mClassName(className), mProgID(progID)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
mClassID = aClass;
|
||||
}
|
||||
|
||||
RDFFactoryImpl::~RDFFactoryImpl()
|
||||
|
@ -88,8 +94,7 @@ RDFFactoryImpl::~RDFFactoryImpl()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFFactoryImpl::QueryInterface(const nsIID &aIID,
|
||||
void **aResult)
|
||||
RDFFactoryImpl::QueryInterface(const nsIID &aIID, void **aResult)
|
||||
{
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
@ -112,6 +117,8 @@ RDFFactoryImpl::QueryInterface(const nsIID &aIID,
|
|||
NS_IMPL_ADDREF(RDFFactoryImpl);
|
||||
NS_IMPL_RELEASE(RDFFactoryImpl);
|
||||
|
||||
extern nsresult
|
||||
NS_NewDefaultResource(nsIRDFResource** aResult);
|
||||
|
||||
NS_IMETHODIMP
|
||||
RDFFactoryImpl::CreateInstance(nsISupports *aOuter,
|
||||
|
@ -177,6 +184,10 @@ RDFFactoryImpl::CreateInstance(nsISupports *aOuter,
|
|||
else if (mClassID.Equals(kXULContentSinkCID)) {
|
||||
if (NS_FAILED(rv = NS_NewXULContentSink((nsIXULContentSink**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else if (mClassID.Equals(kRDFDefaultResourceCID)) {
|
||||
if (NS_FAILED(rv = NS_NewDefaultResource((nsIRDFResource**) &inst)))
|
||||
return rv;
|
||||
}
|
||||
else {
|
||||
return NS_ERROR_NO_INTERFACE;
|
||||
|
@ -207,12 +218,16 @@ nsresult RDFFactoryImpl::LockFactory(PRBool aLock)
|
|||
|
||||
// return the proper factory to the caller
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* aServiceManager, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (! aFactory)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
RDFFactoryImpl* factory = new RDFFactoryImpl(aClass);
|
||||
RDFFactoryImpl* factory = new RDFFactoryImpl(aClass, aClassName, aProgID);
|
||||
if (factory == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -225,39 +240,94 @@ NSGetFactory(const nsCID &aClass, nsISupports* aServiceManager, nsIFactory **aFa
|
|||
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSRegisterSelf(const char* aPath)
|
||||
NSRegisterSelf(nsISupports* serviceMgr, const char* aPath)
|
||||
{
|
||||
nsRepository::RegisterFactory(kRDFBookmarkDataSourceCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kRDFCompositeDataSourceCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kRDFContentSinkCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kRDFHTMLBuilderCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kRDFInMemoryDataSourceCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kRDFServiceCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kRDFTreeBuilderCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kRDFXMLDataSourceCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kRDFXULBuilderCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kXULContentSinkCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kXULDataSourceCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsRepository::RegisterFactory(kXULDocumentCID, aPath, PR_TRUE, PR_TRUE);
|
||||
nsresult rv;
|
||||
// XXX return error codes!
|
||||
|
||||
// register our build-in datasources:
|
||||
rv = nsRepository::RegisterComponent(kRDFBookmarkDataSourceCID,
|
||||
"Bookmarks",
|
||||
NS_RDF_DATASOURCE_PROGID_PREFIX "bookmarks",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kRDFCompositeDataSourceCID,
|
||||
"RDF Composite Data Source",
|
||||
NS_RDF_DATASOURCE_PROGID_PREFIX "composite-datasource",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kRDFInMemoryDataSourceCID,
|
||||
"RDF In-Memory Data Source",
|
||||
NS_RDF_DATASOURCE_PROGID_PREFIX "in-memory-datasource",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kRDFXMLDataSourceCID,
|
||||
"RDF XML Data Source",
|
||||
NS_RDF_DATASOURCE_PROGID_PREFIX "xml-datasource",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kXULDataSourceCID,
|
||||
"XUL Data Source",
|
||||
NS_RDF_DATASOURCE_PROGID_PREFIX "xul-datasource",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
|
||||
// register our built-in resource factories:
|
||||
rv = nsRepository::RegisterComponent(kRDFDefaultResourceCID,
|
||||
"RDF Default Resource Factory",
|
||||
NS_RDF_RESOURCE_FACTORY_PROGID, // default resource factory has no name= part
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
|
||||
// register all the other rdf components:
|
||||
rv = nsRepository::RegisterComponent(kRDFContentSinkCID,
|
||||
"RDF Content Sink",
|
||||
NS_RDF_PROGID "|content-sink",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kRDFHTMLBuilderCID,
|
||||
"RDF HTML Builder",
|
||||
NS_RDF_PROGID "|html-builder",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kRDFServiceCID,
|
||||
"RDF Service",
|
||||
NS_RDF_PROGID "|rdf-service",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kRDFTreeBuilderCID,
|
||||
"RDF Tree Builder",
|
||||
NS_RDF_PROGID "|tree-builder",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kRDFXULBuilderCID,
|
||||
"RDF XUL Builder",
|
||||
NS_RDF_PROGID "|xul-builder",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kXULContentSinkCID,
|
||||
"XUL Content Sink",
|
||||
NS_RDF_PROGID "|xul-content-sink",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
rv = nsRepository::RegisterComponent(kXULDocumentCID,
|
||||
"XUL Document",
|
||||
NS_RDF_PROGID "|xul-document",
|
||||
aPath, PR_TRUE, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
extern "C" PR_IMPLEMENT(nsresult)
|
||||
NSUnregisterSelf(const char* aPath)
|
||||
NSUnregisterSelf(nsISupports* serviceMgr, const char* aPath)
|
||||
{
|
||||
nsRepository::UnregisterFactory(kRDFBookmarkDataSourceCID, aPath);
|
||||
nsRepository::UnregisterFactory(kRDFCompositeDataSourceCID, aPath);
|
||||
nsRepository::UnregisterFactory(kRDFContentSinkCID, aPath);
|
||||
nsRepository::UnregisterFactory(kRDFHTMLBuilderCID, aPath);
|
||||
nsRepository::UnregisterFactory(kRDFInMemoryDataSourceCID, aPath);
|
||||
nsRepository::UnregisterFactory(kRDFServiceCID, aPath);
|
||||
nsRepository::UnregisterFactory(kRDFTreeBuilderCID, aPath);
|
||||
nsRepository::UnregisterFactory(kRDFXMLDataSourceCID, aPath);
|
||||
nsRepository::UnregisterFactory(kRDFXULBuilderCID, aPath);
|
||||
nsRepository::UnregisterFactory(kXULContentSinkCID, aPath);
|
||||
nsRepository::UnregisterFactory(kXULDataSourceCID, aPath);
|
||||
nsRepository::UnregisterFactory(kXULDocumentCID, aPath);
|
||||
nsresult rv;
|
||||
// XXX return error codes!
|
||||
|
||||
rv = nsRepository::UnregisterComponent(kRDFBookmarkDataSourceCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kRDFCompositeDataSourceCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kRDFInMemoryDataSourceCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kRDFXMLDataSourceCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kXULDataSourceCID, aPath);
|
||||
|
||||
rv = nsRepository::UnregisterComponent(kRDFDefaultResourceCID, aPath);
|
||||
|
||||
rv = nsRepository::UnregisterComponent(kRDFContentSinkCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kRDFHTMLBuilderCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kRDFServiceCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kRDFTreeBuilderCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kRDFXULBuilderCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kXULContentSinkCID, aPath);
|
||||
rv = nsRepository::UnregisterComponent(kXULDocumentCID, aPath);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -711,9 +711,23 @@ HT_WriteOutAsBookmarks1 (RDF rdf, PRFileDesc *fp, RDF_Resource u, RDF_Resource t
|
|||
}
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsXPComFactory.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
nsresult
|
||||
NS_NewRDFBookmarkDataSourceFactory(nsIFactory** aResult)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsIFactory* inst = new nsFactory<BookmarkDataSourceImpl>();
|
||||
if (NULL == inst) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
} else {
|
||||
NS_ADDREF(inst);
|
||||
}
|
||||
*aResult = inst;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewRDFBookmarkDataSource(nsIRDFDataSource** result)
|
||||
|
|
|
@ -62,7 +62,6 @@ static NS_DEFINE_IID(kIRDFCursorIID, NS_IRDFCURSOR_IID);
|
|||
static NS_DEFINE_IID(kIRDFArcsOutCursorIID, NS_IRDFARCSOUTCURSOR_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID);
|
||||
static NS_DEFINE_IID(kIRDFResourceFactoryIID, NS_IRDFRESOURCEFACTORY_IID);
|
||||
static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID);
|
||||
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIRDFNode methods:
|
||||
NS_IMETHOD Init(const char* uri);
|
||||
NS_IMETHOD EqualsNode(nsIRDFNode* node, PRBool* result) const;
|
||||
|
||||
// nsIRDFResource methods:
|
||||
|
@ -40,7 +41,7 @@ public:
|
|||
NS_IMETHOD EqualsString(const char* uri, PRBool* result) const;
|
||||
|
||||
// nsRDFResource methods:
|
||||
nsRDFResource(const char* uri);
|
||||
nsRDFResource(void);
|
||||
virtual ~nsRDFResource(void);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -27,8 +27,8 @@ static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsRDFResource::nsRDFResource(const char* uri)
|
||||
: mURI(nsCRT::strdup(uri))
|
||||
nsRDFResource::nsRDFResource(void)
|
||||
: mURI(nsnull)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ nsRDFResource::~nsRDFResource(void)
|
|||
|
||||
PR_ASSERT(NS_SUCCEEDED(rv));
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mgr->UnCacheResource(this);
|
||||
mgr->UnregisterResource(this);
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, mgr);
|
||||
}
|
||||
|
||||
|
@ -77,6 +77,15 @@ nsRDFResource::QueryInterface(REFNSIID iid, void** result)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRDFNode methods:
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFResource::Init(const char* uri)
|
||||
{
|
||||
mURI = nsCRT::strdup(uri);
|
||||
if (mURI == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsRDFResource::EqualsNode(nsIRDFNode* node, PRBool* result) const
|
||||
{
|
||||
|
|
|
@ -1424,13 +1424,13 @@ nsSilentDownloadListener::SetSilentDownloadInfo(nsIDOMSilentDownloadTask* con)
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PRBool (gInstanceCnt == 0 && gLockCnt == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char *path)
|
||||
NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
printf("*** SilentDownload is being registered\n");
|
||||
nsRepository::RegisterFactory(kSilentDownloadCID, path, PR_TRUE, PR_TRUE);
|
||||
|
@ -1439,7 +1439,7 @@ NSRegisterSelf(const char *path)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char *path)
|
||||
NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
printf("*** SilentDownload is being unregistered\n");
|
||||
|
||||
|
@ -1452,7 +1452,11 @@ NSUnregisterSelf(const char *path)
|
|||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
|
||||
if (aFactory == NULL)
|
||||
|
|
|
@ -46,16 +46,20 @@
|
|||
// DLL Entry Points:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory);
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void);
|
||||
NSCanUnload(nsISupports* serviceMgr);
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char *path);
|
||||
NSRegisterSelf(nsISupports* serviceMgr, const char *path);
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char *path);
|
||||
NSUnregisterSelf(nsISupports* serviceMgr, const char *path);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsSilentDownloadListener:
|
||||
|
|
|
@ -151,9 +151,19 @@ nsresult nsViewFactory::LockFactory(PRBool aLock)
|
|||
|
||||
// return the proper factory to the caller
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_VIEW nsresult NSGetFactory_VIEW_DLL(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_VIEW nsresult
|
||||
NSGetFactory_VIEW_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_VIEW nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_VIEW nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
|
|
|
@ -23,7 +23,12 @@ static NS_DEFINE_IID(kIPluginIID, NS_IPLUGIN_IID);
|
|||
|
||||
static CActiveXPlugin *gpFactory = NULL;
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aClass.Equals(kIPluginIID))
|
||||
{
|
||||
|
@ -48,7 +53,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, nsISupports* ser
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(void)
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return (_Module.GetLockCount() == 0);
|
||||
}
|
||||
|
|
|
@ -32,9 +32,19 @@ nsresult NS_NewDocLoaderServiceFactory(nsIFactory** aResult);
|
|||
|
||||
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_WEB nsresult NSGetFactory_WEB_DLL(const nsCID& aClass, nsISupports* servMgr, nsIFactory** aFactory)
|
||||
extern "C" NS_WEB nsresult
|
||||
NSGetFactory_WEB_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_WEB nsresult NSGetFactory(const nsCID& aClass, nsISupports* servMgr, nsIFactory** aFactory)
|
||||
extern "C" NS_WEB nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
|
|
@ -178,10 +178,10 @@ nsViewerApp::SetupRegistry()
|
|||
// Register our browser window factory
|
||||
nsIFactory* bwf;
|
||||
NS_NewBrowserWindowFactory(&bwf);
|
||||
nsRepository::RegisterFactory(kBrowserWindowCID, bwf, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kBrowserWindowCID, 0, 0, bwf, PR_FALSE);
|
||||
|
||||
NS_NewXPBaseWindowFactory(&bwf);
|
||||
nsRepository::RegisterFactory(kXPBaseWindowCID, bwf, PR_FALSE);
|
||||
nsRepository::RegisterFactory(kXPBaseWindowCID, 0, 0, bwf, PR_FALSE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -252,7 +252,12 @@ nsresult nsWidgetFactory::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_WIDGET nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory )
|
||||
extern "C" NS_WIDGET nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -277,7 +277,12 @@ nsresult nsWidgetFactory::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_WIDGET nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_WIDGET nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -252,7 +252,12 @@ nsresult nsWidgetFactory::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_WIDGET nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_WIDGET nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -279,9 +279,19 @@ nsresult nsWidgetFactory::LockFactory(PRBool aLock)
|
|||
//-------------------------------------------------------------------------
|
||||
// return the proper factory to the caller
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_WIDGET nsresult NSGetFactory_WIDGET_DLL(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_WIDGET nsresult
|
||||
NSGetFactory_WIDGET_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_WIDGET nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_WIDGET nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
|
|
|
@ -251,7 +251,12 @@ nsresult nsWidgetFactory::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
// return the proper factory to the caller
|
||||
extern "C" NS_WIDGET nsresult NSGetFactory(const nsCID &aClass, nsISupports* servMgr, nsIFactory **aFactory)
|
||||
extern "C" NS_WIDGET nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (nsnull == aFactory) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
|
|
@ -54,17 +54,63 @@ typedef struct MacLibrary
|
|||
|
||||
#ifdef IMPL_MAC_REPOSITORY
|
||||
|
||||
extern "C" nsresult NSGetFactory_WIDGET_DLL(const nsCID &, nsISupports* , nsIFactory ** );
|
||||
extern "C" nsresult NSGetFactory_GFXWIN_DLL(const nsCID &, nsISupports*, nsIFactory ** );
|
||||
extern "C" nsresult NSGetFactory_VIEW_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_WEB_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
//extern "C" nsresult NSGetFactory_PLUGIN_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_PREF_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_PARSER_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_DOM_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_LAYOUT_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_NETLIB_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_EDITOR_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_WIDGET_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_GFXWIN_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_VIEW_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_WEB_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
#if 0
|
||||
extern "C" nsresult NSGetFactory_PLUGIN_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
#endif
|
||||
extern "C" nsresult NSGetFactory_PREF_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_PARSER_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_DOM_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_LAYOUT_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_NETLIB_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_EDITOR_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
|
||||
extern "C" PRBool NSCanUnload_PREF_DLL(void);
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
@ -564,12 +564,20 @@ nsresult nsRepository::loadFactory(FactoryEntry *aEntry,
|
|||
nsFactoryProc proc = (nsFactoryProc) aEntry->dll->FindSymbol("NSGetFactory");
|
||||
if (proc != NULL)
|
||||
{
|
||||
char* className = NULL;
|
||||
char* progID = NULL;
|
||||
(void)CLSIDToProgID(&aEntry->cid, &className, &progID);
|
||||
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
nsresult res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
if (res == NS_OK)
|
||||
{
|
||||
res = proc(aEntry->cid, serviceMgr, aFactory);
|
||||
}
|
||||
NS_ASSERTION(res == NS_OK, "no service manager");
|
||||
|
||||
res = proc(serviceMgr, aEntry->cid, className, progID, aFactory);
|
||||
|
||||
if (className)
|
||||
delete[] className;
|
||||
if (progID)
|
||||
delete[] progID;
|
||||
return res;
|
||||
}
|
||||
PR_LOG(logmodule, PR_LOG_ERROR,
|
||||
|
@ -697,6 +705,88 @@ nsresult nsRepository::ProgIDToCLSID(const char *aProgID,
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRepository::CLSIDToProgID(nsCID *aClass,
|
||||
char* *aClassName,
|
||||
char* *aProgID)
|
||||
{
|
||||
nsresult res = NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||
#ifdef USE_REGISTRY
|
||||
HREG hreg;
|
||||
char* classnameString;
|
||||
char* progidString;
|
||||
|
||||
checkInitialized();
|
||||
char* cidStr = aClass->ToString();
|
||||
if (PR_LOG_TEST(logmodule, PR_LOG_ALWAYS))
|
||||
{
|
||||
PR_LogPrint("nsRepository: CLSIDToProgID(%s)", cidStr);
|
||||
}
|
||||
|
||||
PR_ASSERT(aClass != NULL);
|
||||
|
||||
REGERR err = NR_RegOpen(NULL, &hreg);
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done1;
|
||||
}
|
||||
|
||||
RKEY classesKey;
|
||||
if (NR_RegAddKey(hreg, ROOTKEY_COMMON, "Classes", &classesKey) != REGERR_OK)
|
||||
{
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done2;
|
||||
}
|
||||
|
||||
RKEY key;
|
||||
err = NR_RegGetKey(hreg, classesKey, cidStr, &key);
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done2;
|
||||
}
|
||||
|
||||
classnameString = new char[MAXREGNAMELEN];
|
||||
if (classnameString == NULL) {
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done2;
|
||||
}
|
||||
err = NR_RegGetEntryString(hreg, key, "ClassName", classnameString, MAXREGNAMELEN);
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
delete[] classnameString;
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done2;
|
||||
}
|
||||
*aClassName = classnameString;
|
||||
|
||||
progidString = new char[MAXREGNAMELEN];
|
||||
if (progidString == NULL) {
|
||||
delete[] classnameString;
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done2;
|
||||
}
|
||||
err = NR_RegGetEntryString(hreg, key, "ProgID", progidString, MAXREGNAMELEN);
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
delete[] progidString;
|
||||
delete[] classnameString;
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done2;
|
||||
}
|
||||
|
||||
*aProgID = progidString;
|
||||
res = NS_OK;
|
||||
#endif /* USE_REGISTRY */
|
||||
|
||||
done2:
|
||||
NR_RegClose(hreg);
|
||||
done1:
|
||||
delete[] cidStr;
|
||||
PR_LOG(logmodule, PR_LOG_WARNING, ("nsRepository: CLSIDToProgID() %s",
|
||||
res == NS_OK ? "succeeded" : "FAILED"));
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRepository::checkInitialized(void)
|
||||
{
|
||||
|
@ -770,6 +860,17 @@ nsresult nsRepository::CreateInstance(const nsCID &aClass,
|
|||
return NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||
}
|
||||
|
||||
nsresult nsRepository::CreateInstance(const char *aProgID,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsCID clsid;
|
||||
nsresult rv = ProgIDToCLSID(aProgID, &clsid);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return CreateInstance(clsid, aDelegate, aIID, aResult);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
|
@ -1158,7 +1259,11 @@ static PRBool freeLibraryEnum(nsHashKey *aKey, void *aData, void* closure)
|
|||
nsCanUnloadProc proc = (nsCanUnloadProc) entry->dll->FindSymbol("NSCanUnload");
|
||||
if (proc != NULL)
|
||||
{
|
||||
PRBool res = proc();
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
nsresult res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
NS_ASSERTION(res == NS_OK, "no service manager");
|
||||
|
||||
res = proc(serviceMgr);
|
||||
if (res)
|
||||
{
|
||||
PR_LOG(logmodule, PR_LOG_ALWAYS,
|
||||
|
@ -1433,7 +1538,11 @@ nsresult nsRepository::SyncComponentsInFile(const char *fullname)
|
|||
dll->FindSymbol("NSCanUnload");
|
||||
if (proc != NULL)
|
||||
{
|
||||
PRBool res = proc(/*PR_TRUE*/);
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
nsresult rv = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
NS_ASSERTION(rv == NS_OK, "no service manager");
|
||||
|
||||
PRBool res = proc(serviceMgr /*, PR_TRUE*/);
|
||||
if (res)
|
||||
{
|
||||
PR_LOG(logmodule, PR_LOG_ALWAYS,
|
||||
|
@ -1563,10 +1672,9 @@ nsresult nsRepository::SelfRegisterDll(nsDll *dll)
|
|||
// Call the NSRegisterSelfProc to enable dll registration
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
if (res == NS_OK)
|
||||
{
|
||||
res = regproc(/* serviceMgr, */ dll->GetFullPath());
|
||||
}
|
||||
NS_ASSERTION(res == NS_OK, "no service manager");
|
||||
|
||||
res = regproc(serviceMgr, dll->GetFullPath());
|
||||
}
|
||||
dll->Unload();
|
||||
return (res);
|
||||
|
@ -1604,10 +1712,9 @@ nsresult nsRepository::SelfUnregisterDll(nsDll *dll)
|
|||
// Call the NSUnregisterSelfProc to enable dll de-registration
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
if (res == NS_OK)
|
||||
{
|
||||
res = unregproc(/* serviceMgr, */dll->GetFullPath());
|
||||
}
|
||||
NS_ASSERTION(res == NS_OK, "no service manager");
|
||||
|
||||
res = unregproc(serviceMgr, dll->GetFullPath());
|
||||
}
|
||||
dll->Unload();
|
||||
return (res);
|
||||
|
|
|
@ -44,12 +44,14 @@ class nsIServiceManager;
|
|||
// sudu / stanley
|
||||
//
|
||||
//***********************************************************
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass,
|
||||
nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload();
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *fullpath);
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *fullpath);
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr);
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *fullpath);
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *fullpath);
|
||||
|
||||
/* Quick Registration
|
||||
*
|
||||
|
@ -90,12 +92,14 @@ typedef NSQuickRegisterClassData* NSQuickRegisterData;
|
|||
* Dynamic library export function types
|
||||
*/
|
||||
|
||||
typedef nsresult (*nsFactoryProc)(const nsCID &aCLass,
|
||||
nsISupports* serviceMgr,
|
||||
typedef nsresult (*nsFactoryProc)(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
typedef PRBool (*nsCanUnloadProc)(void);
|
||||
typedef nsresult (*nsRegisterProc)(const char *path);
|
||||
typedef nsresult (*nsUnregisterProc)(const char *path);
|
||||
typedef PRBool (*nsCanUnloadProc)(nsISupports* serviceMgr);
|
||||
typedef nsresult (*nsRegisterProc)(nsISupports* serviceMgr, const char *path);
|
||||
typedef nsresult (*nsUnregisterProc)(nsISupports* serviceMgr, const char *path);
|
||||
|
||||
/*
|
||||
* Support types
|
||||
|
@ -150,12 +154,24 @@ public:
|
|||
static nsresult ProgIDToCLSID(const char *aProgID,
|
||||
nsCID *aClass);
|
||||
|
||||
// Finds a Program ID for a specific class ID
|
||||
// caller frees the result with delete[]
|
||||
static nsresult CLSIDToProgID(nsCID *aClass,
|
||||
char* *aClassName,
|
||||
char* *aProgID);
|
||||
|
||||
// Creates a class instance for a specific class ID
|
||||
static nsresult CreateInstance(const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Convenience routine, creates a class instance for a specific ProgID
|
||||
static nsresult CreateInstance(const char *aProgID,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Creates a class instance for a specific class ID
|
||||
/*
|
||||
static nsresult CreateInstance2(const nsCID &aClass,
|
||||
|
|
|
@ -54,17 +54,63 @@ typedef struct MacLibrary
|
|||
|
||||
#ifdef IMPL_MAC_REPOSITORY
|
||||
|
||||
extern "C" nsresult NSGetFactory_WIDGET_DLL(const nsCID &, nsISupports* , nsIFactory ** );
|
||||
extern "C" nsresult NSGetFactory_GFXWIN_DLL(const nsCID &, nsISupports*, nsIFactory ** );
|
||||
extern "C" nsresult NSGetFactory_VIEW_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_WEB_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
//extern "C" nsresult NSGetFactory_PLUGIN_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_PREF_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_PARSER_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_DOM_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_LAYOUT_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_NETLIB_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_EDITOR_DLL(const nsCID &, nsISupports*, nsIFactory **);
|
||||
extern "C" nsresult NSGetFactory_WIDGET_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_GFXWIN_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_VIEW_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_WEB_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
#if 0
|
||||
extern "C" nsresult NSGetFactory_PLUGIN_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
#endif
|
||||
extern "C" nsresult NSGetFactory_PREF_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_PARSER_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_DOM_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_LAYOUT_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_NETLIB_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" nsresult NSGetFactory_EDITOR_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
|
||||
extern "C" PRBool NSCanUnload_PREF_DLL(void);
|
||||
|
||||
|
|
|
@ -44,12 +44,14 @@ class nsIServiceManager;
|
|||
// sudu / stanley
|
||||
//
|
||||
//***********************************************************
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass,
|
||||
nsISupports* serviceMgr,
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload();
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *fullpath);
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *fullpath);
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr);
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *fullpath);
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *fullpath);
|
||||
|
||||
/* Quick Registration
|
||||
*
|
||||
|
@ -90,12 +92,14 @@ typedef NSQuickRegisterClassData* NSQuickRegisterData;
|
|||
* Dynamic library export function types
|
||||
*/
|
||||
|
||||
typedef nsresult (*nsFactoryProc)(const nsCID &aCLass,
|
||||
nsISupports* serviceMgr,
|
||||
typedef nsresult (*nsFactoryProc)(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory);
|
||||
typedef PRBool (*nsCanUnloadProc)(void);
|
||||
typedef nsresult (*nsRegisterProc)(const char *path);
|
||||
typedef nsresult (*nsUnregisterProc)(const char *path);
|
||||
typedef PRBool (*nsCanUnloadProc)(nsISupports* serviceMgr);
|
||||
typedef nsresult (*nsRegisterProc)(nsISupports* serviceMgr, const char *path);
|
||||
typedef nsresult (*nsUnregisterProc)(nsISupports* serviceMgr, const char *path);
|
||||
|
||||
/*
|
||||
* Support types
|
||||
|
@ -150,12 +154,24 @@ public:
|
|||
static nsresult ProgIDToCLSID(const char *aProgID,
|
||||
nsCID *aClass);
|
||||
|
||||
// Finds a Program ID for a specific class ID
|
||||
// caller frees the result with delete[]
|
||||
static nsresult CLSIDToProgID(nsCID *aClass,
|
||||
char* *aClassName,
|
||||
char* *aProgID);
|
||||
|
||||
// Creates a class instance for a specific class ID
|
||||
static nsresult CreateInstance(const nsCID &aClass,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Convenience routine, creates a class instance for a specific ProgID
|
||||
static nsresult CreateInstance(const char *aProgID,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult);
|
||||
|
||||
// Creates a class instance for a specific class ID
|
||||
/*
|
||||
static nsresult CreateInstance2(const nsCID &aClass,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Netscape Public License
|
||||
* Version 1.0 (the "NPL"); you may not use this file except in
|
||||
|
@ -564,12 +564,20 @@ nsresult nsRepository::loadFactory(FactoryEntry *aEntry,
|
|||
nsFactoryProc proc = (nsFactoryProc) aEntry->dll->FindSymbol("NSGetFactory");
|
||||
if (proc != NULL)
|
||||
{
|
||||
char* className = NULL;
|
||||
char* progID = NULL;
|
||||
(void)CLSIDToProgID(&aEntry->cid, &className, &progID);
|
||||
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
nsresult res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
if (res == NS_OK)
|
||||
{
|
||||
res = proc(aEntry->cid, serviceMgr, aFactory);
|
||||
}
|
||||
NS_ASSERTION(res == NS_OK, "no service manager");
|
||||
|
||||
res = proc(serviceMgr, aEntry->cid, className, progID, aFactory);
|
||||
|
||||
if (className)
|
||||
delete[] className;
|
||||
if (progID)
|
||||
delete[] progID;
|
||||
return res;
|
||||
}
|
||||
PR_LOG(logmodule, PR_LOG_ERROR,
|
||||
|
@ -697,6 +705,88 @@ nsresult nsRepository::ProgIDToCLSID(const char *aProgID,
|
|||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRepository::CLSIDToProgID(nsCID *aClass,
|
||||
char* *aClassName,
|
||||
char* *aProgID)
|
||||
{
|
||||
nsresult res = NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||
#ifdef USE_REGISTRY
|
||||
HREG hreg;
|
||||
char* classnameString;
|
||||
char* progidString;
|
||||
|
||||
checkInitialized();
|
||||
char* cidStr = aClass->ToString();
|
||||
if (PR_LOG_TEST(logmodule, PR_LOG_ALWAYS))
|
||||
{
|
||||
PR_LogPrint("nsRepository: CLSIDToProgID(%s)", cidStr);
|
||||
}
|
||||
|
||||
PR_ASSERT(aClass != NULL);
|
||||
|
||||
REGERR err = NR_RegOpen(NULL, &hreg);
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done1;
|
||||
}
|
||||
|
||||
RKEY classesKey;
|
||||
if (NR_RegAddKey(hreg, ROOTKEY_COMMON, "Classes", &classesKey) != REGERR_OK)
|
||||
{
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done2;
|
||||
}
|
||||
|
||||
RKEY key;
|
||||
err = NR_RegGetKey(hreg, classesKey, cidStr, &key);
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done2;
|
||||
}
|
||||
|
||||
classnameString = new char[MAXREGNAMELEN];
|
||||
if (classnameString == NULL) {
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done2;
|
||||
}
|
||||
err = NR_RegGetEntryString(hreg, key, "ClassName", classnameString, MAXREGNAMELEN);
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
delete[] classnameString;
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done2;
|
||||
}
|
||||
*aClassName = classnameString;
|
||||
|
||||
progidString = new char[MAXREGNAMELEN];
|
||||
if (progidString == NULL) {
|
||||
delete[] classnameString;
|
||||
res = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done2;
|
||||
}
|
||||
err = NR_RegGetEntryString(hreg, key, "ProgID", progidString, MAXREGNAMELEN);
|
||||
if (err != REGERR_OK)
|
||||
{
|
||||
delete[] progidString;
|
||||
delete[] classnameString;
|
||||
res = NS_ERROR_FAILURE;
|
||||
goto done2;
|
||||
}
|
||||
|
||||
*aProgID = progidString;
|
||||
res = NS_OK;
|
||||
#endif /* USE_REGISTRY */
|
||||
|
||||
done2:
|
||||
NR_RegClose(hreg);
|
||||
done1:
|
||||
delete[] cidStr;
|
||||
PR_LOG(logmodule, PR_LOG_WARNING, ("nsRepository: CLSIDToProgID() %s",
|
||||
res == NS_OK ? "succeeded" : "FAILED"));
|
||||
return res;
|
||||
}
|
||||
|
||||
nsresult nsRepository::checkInitialized(void)
|
||||
{
|
||||
|
@ -770,6 +860,17 @@ nsresult nsRepository::CreateInstance(const nsCID &aClass,
|
|||
return NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||
}
|
||||
|
||||
nsresult nsRepository::CreateInstance(const char *aProgID,
|
||||
nsISupports *aDelegate,
|
||||
const nsIID &aIID,
|
||||
void **aResult)
|
||||
{
|
||||
nsCID clsid;
|
||||
nsresult rv = ProgIDToCLSID(aProgID, &clsid);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
return CreateInstance(clsid, aDelegate, aIID, aResult);
|
||||
}
|
||||
|
||||
|
||||
#if 0
|
||||
/*
|
||||
|
@ -1158,7 +1259,11 @@ static PRBool freeLibraryEnum(nsHashKey *aKey, void *aData, void* closure)
|
|||
nsCanUnloadProc proc = (nsCanUnloadProc) entry->dll->FindSymbol("NSCanUnload");
|
||||
if (proc != NULL)
|
||||
{
|
||||
PRBool res = proc();
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
nsresult res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
NS_ASSERTION(res == NS_OK, "no service manager");
|
||||
|
||||
res = proc(serviceMgr);
|
||||
if (res)
|
||||
{
|
||||
PR_LOG(logmodule, PR_LOG_ALWAYS,
|
||||
|
@ -1433,7 +1538,11 @@ nsresult nsRepository::SyncComponentsInFile(const char *fullname)
|
|||
dll->FindSymbol("NSCanUnload");
|
||||
if (proc != NULL)
|
||||
{
|
||||
PRBool res = proc(/*PR_TRUE*/);
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
nsresult rv = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
NS_ASSERTION(rv == NS_OK, "no service manager");
|
||||
|
||||
PRBool res = proc(serviceMgr /*, PR_TRUE*/);
|
||||
if (res)
|
||||
{
|
||||
PR_LOG(logmodule, PR_LOG_ALWAYS,
|
||||
|
@ -1563,10 +1672,9 @@ nsresult nsRepository::SelfRegisterDll(nsDll *dll)
|
|||
// Call the NSRegisterSelfProc to enable dll registration
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
if (res == NS_OK)
|
||||
{
|
||||
res = regproc(/* serviceMgr, */ dll->GetFullPath());
|
||||
}
|
||||
NS_ASSERTION(res == NS_OK, "no service manager");
|
||||
|
||||
res = regproc(serviceMgr, dll->GetFullPath());
|
||||
}
|
||||
dll->Unload();
|
||||
return (res);
|
||||
|
@ -1604,10 +1712,9 @@ nsresult nsRepository::SelfUnregisterDll(nsDll *dll)
|
|||
// Call the NSUnregisterSelfProc to enable dll de-registration
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
if (res == NS_OK)
|
||||
{
|
||||
res = unregproc(/* serviceMgr, */dll->GetFullPath());
|
||||
}
|
||||
NS_ASSERTION(res == NS_OK, "no service manager");
|
||||
|
||||
res = unregproc(serviceMgr, dll->GetFullPath());
|
||||
}
|
||||
dll->Unload();
|
||||
return (res);
|
||||
|
|
|
@ -29,9 +29,19 @@ nsresult NS_NewEventQueueServiceFactory(nsIFactory** aResult);
|
|||
* Define the global NSGetFactory(...) entry point for the xpcom DLL...
|
||||
*/
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory_XPCOM_DLL(const nsCID& aClass, nsISupports* servMgr, nsIFactory** aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory_XPCOM_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID& aClass, nsISupports* servMgr, nsIFactory** aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
if (NULL == aFactory) {
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "plstr.h"
|
||||
#include "prlink.h"
|
||||
#include "nsRepository.h"
|
||||
#include "nsIServiceManager.h"
|
||||
|
||||
static PRBool gUnreg = PR_FALSE;
|
||||
|
||||
|
@ -54,7 +55,12 @@ nsresult Register(const char *path)
|
|||
nsRegisterProc proc = (nsRegisterProc) PR_FindSymbol(instance,
|
||||
"NSRegisterSelf");
|
||||
if (proc != NULL) {
|
||||
res = proc(path);
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
if (res == NS_OK)
|
||||
{
|
||||
res = proc(serviceMgr, path);
|
||||
}
|
||||
}
|
||||
PR_UnloadLibrary(instance);
|
||||
} else {
|
||||
|
@ -72,7 +78,12 @@ nsresult Unregister(const char *path)
|
|||
nsUnregisterProc proc = (nsUnregisterProc) PR_FindSymbol(instance,
|
||||
"NSUnregisterSelf");
|
||||
if (proc != NULL) {
|
||||
res = proc(path);
|
||||
nsIServiceManager* serviceMgr = NULL;
|
||||
res = nsServiceManager::GetGlobalServiceManager(&serviceMgr);
|
||||
if (res == NS_OK)
|
||||
{
|
||||
res = proc(serviceMgr, path);
|
||||
}
|
||||
}
|
||||
PR_UnloadLibrary(instance);
|
||||
} else {
|
||||
|
|
|
@ -130,8 +130,8 @@ nsresult TestFactory::CreateInstance(nsISupports *aDelegate,
|
|||
*/
|
||||
|
||||
extern "C" void RegisterTestFactories() {
|
||||
nsRepository::RegisterFactory(kTestFactoryCID, new TestFactory(),
|
||||
PR_FALSE);
|
||||
nsRepository::RegisterFactory(kTestFactoryCID, 0, 0,
|
||||
new TestFactory(), PR_FALSE);
|
||||
|
||||
// Windows can use persistant registry
|
||||
#ifndef USE_NSREG
|
||||
|
|
|
@ -105,13 +105,16 @@ nsresult TestDynamicFactory::CreateInstance(nsISupports *aDelegate,
|
|||
return res;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
||||
nsISupports* serviceMgr,
|
||||
nsIFactory **aFactory) {
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (aFactory == NULL) {
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
}
|
||||
if (aCID.Equals(kTestLoadedFactoryCID)) {
|
||||
if (aClass.Equals(kTestLoadedFactoryCID)) {
|
||||
TestDynamicFactory *factory = new TestDynamicFactory();
|
||||
nsresult res = factory->QueryInterface(kFactoryIID, (void **) aFactory);
|
||||
if (NS_FAILED(res)) {
|
||||
|
@ -123,17 +126,17 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID,
|
|||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload() {
|
||||
extern "C" NS_EXPORT PRBool NSCanUnload(nsISupports* serviceMgr) {
|
||||
return PRBool(g_FactoryCount == 0 && g_LockCount == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::RegisterFactory(kTestLoadedFactoryCID, path,
|
||||
PR_TRUE, PR_TRUE);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *path)
|
||||
extern "C" NS_EXPORT nsresult NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
return nsRepository::UnregisterFactory(kTestLoadedFactoryCID, path);
|
||||
}
|
||||
|
|
|
@ -136,7 +136,11 @@ MyServiceFactory::LockFactory(PRBool aLock)
|
|||
static NS_DEFINE_IID(kIMyServiceCID, NS_IMYSERVICE_CID);
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
if (!aClass.Equals(kIMyServiceCID))
|
||||
return NS_ERROR_FACTORY_NOT_REGISTERED;
|
||||
|
@ -153,7 +157,7 @@ NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
if (gFact && gFact->CanUnload()) {
|
||||
nsrefcnt cnt = gFact->Release();
|
||||
|
|
|
@ -48,13 +48,13 @@ static NS_DEFINE_IID(kAppCoresManagerCID, NS_APPCORESMANAGER_CID);
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void)
|
||||
NSCanUnload(nsISupports* serviceMgr)
|
||||
{
|
||||
return PRBool (gInstanceCnt == 0 && gLockCnt == 0);
|
||||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char *path)
|
||||
NSRegisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
printf("*** AppCores is being registered\n");
|
||||
nsRepository::RegisterFactory(kAppCoresManagerCID, path, PR_TRUE, PR_TRUE);
|
||||
|
@ -68,7 +68,7 @@ NSRegisterSelf(const char *path)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char *path)
|
||||
NSUnregisterSelf(nsISupports* serviceMgr, const char *path)
|
||||
{
|
||||
printf("*** AppCores is being unregistered\n");
|
||||
|
||||
|
@ -86,7 +86,11 @@ NSUnregisterSelf(const char *path)
|
|||
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory)
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
|
||||
if (aFactory == NULL)
|
||||
|
|
|
@ -26,17 +26,6 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
// DLL Entry Points:
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &aClass, nsISupports* serviceMgr, nsIFactory **aFactory);
|
||||
|
||||
extern "C" NS_EXPORT PRBool
|
||||
NSCanUnload(void);
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSRegisterSelf(const char *path);
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSUnregisterSelf(const char *path);
|
||||
|
||||
extern "C" void
|
||||
IncInstanceCount();
|
||||
|
|
|
@ -368,7 +368,12 @@ nsAppRunnerFactory::LockFactory(PRBool aLock)
|
|||
}
|
||||
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(const nsCID &cid, nsISupports* servMgr, nsIFactory** aFactory ) {
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
if ( aFactory == 0 ) {
|
||||
|
|
|
@ -30,9 +30,19 @@ static NS_DEFINE_IID(kCmdLineServiceCID, NS_COMMANDLINE_SERVICE_CID);
|
|||
|
||||
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_APPSHELL nsresult NSGetFactory_APPSHELL_DLL(const nsCID& aClass, nsISupports* servMgr, nsIFactory** aFactory)
|
||||
extern "C" NS_APPSHELL nsresult
|
||||
NSGetFactory_APPSHELL_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_APPSHELL nsresult NSGetFactory(const nsCID& aClass, nsISupports* servMgr, nsIFactory** aFactory)
|
||||
extern "C" NS_APPSHELL nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
|
|
@ -30,9 +30,19 @@
|
|||
|
||||
|
||||
#if defined(XP_MAC) && defined(MAC_STATIC)
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory_WEB_DLL(const nsCID& aClass, nsISupports* servMgr, nsIFactory** aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory_WEB_DLL(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#else
|
||||
extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID& aClass, nsISupports* servMgr, nsIFactory** aFactory)
|
||||
extern "C" NS_EXPORT nsresult
|
||||
NSGetFactory(nsISupports* serviceMgr,
|
||||
const nsCID &aClass,
|
||||
const char *aClassName,
|
||||
const char *aProgID,
|
||||
nsIFactory **aFactory)
|
||||
#endif
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче