зеркало из https://github.com/mozilla/pjs.git
Fixes XPCOM Glue on linux, b=168584, sr=rpotts, r=alec
This commit is contained in:
Родитель
afa91aed6b
Коммит
a08bffac6a
|
@ -109,6 +109,17 @@
|
|||
#endif
|
||||
#include "nsRecyclingAllocator.h"
|
||||
|
||||
// seawood tells me there isn't a better way...
|
||||
#ifdef XP_PC
|
||||
#define XPCOM_DLL "xpcom.dll"
|
||||
#else
|
||||
#ifdef XP_MAC
|
||||
#define XPCOM_DLL "XPCOM_DLL"
|
||||
#else
|
||||
#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Registry Factory creation function defined in nsRegistry.cpp
|
||||
// We hook into this function locally to create and register the registry
|
||||
// Since noone outside xpcom needs to know about this and nsRegistry.cpp
|
||||
|
@ -359,11 +370,6 @@ static const nsModuleComponentInfo components[] = {
|
|||
|
||||
const int components_length = sizeof(components) / sizeof(components[0]);
|
||||
|
||||
static const PRStaticLinkTable sGlueSymbols[] = { {
|
||||
"NS_GetFrozenFunctions",
|
||||
(void (* PR_CALLBACK)())&NS_GetFrozenFunctions
|
||||
} } ;
|
||||
|
||||
// gMemory will be freed during shutdown.
|
||||
static nsIMemory* gMemory = nsnull;
|
||||
nsresult NS_COM NS_GetMemoryManager(nsIMemory* *result)
|
||||
|
@ -417,8 +423,6 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
|
|||
|
||||
StartupSpecialSystemDirectory();
|
||||
|
||||
PR_LoadStaticLibrary("XPCOMComponentGlue", sGlueSymbols);
|
||||
|
||||
// Start the directory service so that the component manager init can use it.
|
||||
rv = nsDirectoryService::Create(nsnull,
|
||||
NS_GET_IID(nsIProperties),
|
||||
|
@ -442,14 +446,18 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
|
|||
if (compMgr == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
NS_ADDREF(compMgr);
|
||||
|
||||
|
||||
nsCOMPtr<nsIFile> xpcomLib;
|
||||
|
||||
PRBool value;
|
||||
if (binDirectory)
|
||||
{
|
||||
rv = binDirectory->IsDirectory(&value);
|
||||
|
||||
if (NS_SUCCEEDED(rv) && value)
|
||||
if (NS_SUCCEEDED(rv) && value) {
|
||||
gDirectoryService->Set(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory);
|
||||
binDirectory->Clone(getter_AddRefs(xpcomLib));
|
||||
}
|
||||
|
||||
//Since people are still using the nsSpecialSystemDirectory, we should init it.
|
||||
nsCAutoString path;
|
||||
|
@ -459,6 +467,17 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
|
|||
nsSpecialSystemDirectory::Set(nsSpecialSystemDirectory::Moz_BinDirectory, &spec);
|
||||
|
||||
}
|
||||
else {
|
||||
gDirectoryService->Get(NS_XPCOM_CURRENT_PROCESS_DIR,
|
||||
NS_GET_IID(nsIFile),
|
||||
getter_AddRefs(xpcomLib));
|
||||
}
|
||||
|
||||
if (xpcomLib) {
|
||||
xpcomLib->AppendNative(nsDependentCString(XPCOM_DLL));
|
||||
gDirectoryService->Set(NS_XPCOM_LIBRARY_FILE, xpcomLib);
|
||||
}
|
||||
|
||||
if (appFileLocationProvider) {
|
||||
rv = dirService->RegisterProvider(appFileLocationProvider);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -775,8 +794,6 @@ nsresult NS_COM NS_ShutdownXPCOM(nsIServiceManager* servMgr)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
|
||||
nsresult NS_COM PR_CALLBACK
|
||||
NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* libraryPath)
|
||||
{
|
||||
|
@ -841,7 +858,6 @@ NS_GetFrozenFunctions(XPCOMFunctions *functions, const char* libraryPath)
|
|||
PR_UnloadLibrary(xpcomLib);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
||||
PR_UnloadLibrary(xpcomLib); // the library is refcnt'ed above by the caller.
|
||||
xpcomLib = nsnull;
|
||||
|
|
|
@ -45,6 +45,14 @@
|
|||
#include "nsIComponentManager.h"
|
||||
#include "nsIComponentRegistrar.h"
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
#include "nsXPCOMGlue.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsDirectoryService.h"
|
||||
#endif
|
||||
|
||||
nsGenericFactory::nsGenericFactory(const nsModuleComponentInfo *info)
|
||||
: mInfo(info)
|
||||
{
|
||||
|
@ -231,6 +239,11 @@ nsGenericModule::nsGenericModule(const char* moduleName, PRUint32 componentCount
|
|||
nsGenericModule::~nsGenericModule()
|
||||
{
|
||||
Shutdown();
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
XPCOMGlueShutdown();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS1(nsGenericModule, nsIModule)
|
||||
|
@ -254,17 +267,45 @@ nsGenericModule::AddFactoryNode(nsIGenericFactory* fact)
|
|||
nsresult
|
||||
nsGenericModule::Initialize(nsIComponentManager *compMgr)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
if (mInitialized) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (mCtor) {
|
||||
nsresult rv = mCtor(this);
|
||||
rv = mCtor(this);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
|
||||
#ifdef XPCOM_GLUE
|
||||
nsCOMPtr<nsIServiceManager> servMgr = do_QueryInterface(compMgr, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIProperties> dirService;
|
||||
rv = servMgr->GetServiceByContractID(NS_DIRECTORY_SERVICE_CONTRACTID,
|
||||
NS_GET_IID(nsIProperties),
|
||||
getter_AddRefs(dirService));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIFile> xpcomDll;
|
||||
rv = dirService->Get(NS_XPCOM_LIBRARY_FILE, NS_GET_IID(nsIFile), getter_AddRefs(xpcomDll));
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCAutoString path;
|
||||
xpcomDll->GetNativePath(path);
|
||||
rv = XPCOMGlueStartup(path.get());
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(compMgr, &rv);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIModule.h"
|
||||
#include "nsIClassInfo.h"
|
||||
|
||||
// {3bc97f01-ccdf-11d2-bab8-b548654461fc}
|
||||
#define NS_GENERICFACTORY_CID \
|
||||
|
|
|
@ -61,7 +61,7 @@ static XPCOMFunctions *xpcomFunctions = nsnull;
|
|||
#ifdef XP_MAC
|
||||
#define XPCOM_DLL "XPCOM_DLL"
|
||||
#else
|
||||
#define XPCOM_DLL "libxpcom.so"
|
||||
#define XPCOM_DLL "libxpcom"MOZ_DLL_SUFFIX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
|
|
@ -79,7 +79,6 @@ endif # OS2
|
|||
EXPORTS = \
|
||||
nsAppDirectoryServiceDefs.h \
|
||||
nsDirectoryService.h \
|
||||
nsDirectoryServiceDefs.h \
|
||||
nsDirectoryServiceUtils.h \
|
||||
nsEscape.h \
|
||||
nsFastLoadPtr.h \
|
||||
|
@ -144,6 +143,10 @@ SDK_XPIDLSRCS = \
|
|||
nsIScriptableInputStream.idl \
|
||||
$(NULL)
|
||||
|
||||
SDK_HEADERS = \
|
||||
nsDirectoryServiceDefs.h \
|
||||
$(NULL)
|
||||
|
||||
EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS))
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a static lib.
|
||||
|
|
|
@ -45,6 +45,9 @@
|
|||
#include "nsISupportsArray.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
#define NS_XPCOM_INIT_CURRENT_PROCESS_DIR "MozBinD" // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
|
||||
// CANNOT be used to GET a location
|
||||
|
||||
class nsDirectoryService : public nsIDirectoryService,
|
||||
public nsIProperties,
|
||||
public nsIDirectoryServiceProvider2
|
||||
|
|
|
@ -48,16 +48,13 @@
|
|||
// Keys whose definition ends in "DIR" or "FILE" return a single nsIFile (or subclass).
|
||||
// Keys whose definition ends in "LIST" return an nsISimpleEnumerator which enumerates a
|
||||
// list of file objects.
|
||||
//
|
||||
//========================================================================================
|
||||
|
||||
|
||||
|
||||
#define NS_XPCOM_INIT_CURRENT_PROCESS_DIR "MozBinD" // Can be used to set NS_XPCOM_CURRENT_PROCESS_DIR
|
||||
// CANNOT be used to GET a location
|
||||
|
||||
#define NS_XPCOM_CURRENT_PROCESS_DIR "XCurProcD"
|
||||
#define NS_XPCOM_COMPONENT_REGISTRY_FILE "ComRegF"
|
||||
#define NS_XPCOM_COMPONENT_DIR "ComsD"
|
||||
#define NS_XPCOM_LIBRARY_FILE "XpcomLib"
|
||||
|
||||
#define NS_GRE_DIR "GreD"
|
||||
#define NS_GRE_COMPONENT_DIR "GreComsD"
|
||||
|
|
Загрузка…
Ссылка в новой задаче