2001-12-07 22:54:16 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2004-02-19 05:44:03 +03:00
|
|
|
/* vim:set ts=4 sw=4 et cindent: */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2001-12-07 22:54:16 +03:00
|
|
|
|
2014-09-26 08:20:23 +04:00
|
|
|
#ifndef nsXPCOMPrivate_h__
|
|
|
|
#define nsXPCOMPrivate_h__
|
2001-12-07 22:54:16 +03:00
|
|
|
|
|
|
|
#include "nscore.h"
|
2002-06-21 23:58:54 +04:00
|
|
|
#include "nsXPCOM.h"
|
2006-05-03 20:11:14 +04:00
|
|
|
#include "nsXPCOMStrings.h"
|
2007-04-24 21:02:51 +04:00
|
|
|
#include "xptcall.h"
|
2004-02-19 05:44:03 +03:00
|
|
|
|
|
|
|
class nsStringContainer;
|
|
|
|
class nsCStringContainer;
|
2005-07-21 17:33:43 +04:00
|
|
|
class nsIComponentLoader;
|
2013-11-26 23:29:59 +04:00
|
|
|
class nsPurpleBufferEntry;
|
2004-02-19 05:44:03 +03:00
|
|
|
|
2005-11-23 17:32:18 +03:00
|
|
|
/**
|
|
|
|
* During this shutdown notification all threads which run XPCOM code must
|
|
|
|
* be joined.
|
|
|
|
*/
|
|
|
|
#define NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID "xpcom-shutdown-threads"
|
|
|
|
|
|
|
|
/**
|
|
|
|
* During this shutdown notification all module loaders must unload XPCOM
|
|
|
|
* modules.
|
|
|
|
*/
|
|
|
|
#define NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID "xpcom-shutdown-loaders"
|
|
|
|
|
2002-06-21 23:58:54 +04:00
|
|
|
// PUBLIC
|
2014-08-13 22:45:37 +04:00
|
|
|
typedef nsresult (*InitFunc)(nsIServiceManager** aResult,
|
|
|
|
nsIFile* aBinDirectory,
|
|
|
|
nsIDirectoryServiceProvider* aAppFileLocationProvider);
|
|
|
|
typedef nsresult (*ShutdownFunc)(nsIServiceManager* aServMgr);
|
|
|
|
typedef nsresult (*GetServiceManagerFunc)(nsIServiceManager** aResult);
|
|
|
|
typedef nsresult (*GetComponentManagerFunc)(nsIComponentManager** aResult);
|
|
|
|
typedef nsresult (*GetComponentRegistrarFunc)(nsIComponentRegistrar** aResult);
|
|
|
|
typedef nsresult (*GetMemoryManagerFunc)(nsIMemory** aResult);
|
|
|
|
typedef nsresult (*NewLocalFileFunc)(const nsAString& aPath,
|
|
|
|
bool aFollowLinks, nsIFile** aResult);
|
|
|
|
typedef nsresult (*NewNativeLocalFileFunc)(const nsACString& aPath,
|
|
|
|
bool aFollowLinks,
|
|
|
|
nsIFile** aResult);
|
|
|
|
|
|
|
|
typedef nsresult (*GetDebugFunc)(nsIDebug** aResult);
|
|
|
|
|
|
|
|
typedef nsresult (*StringContainerInitFunc)(nsStringContainer&);
|
|
|
|
typedef nsresult (*StringContainerInit2Func)(nsStringContainer&,
|
|
|
|
const char16_t*,
|
|
|
|
uint32_t, uint32_t);
|
|
|
|
typedef void (*StringContainerFinishFunc)(nsStringContainer&);
|
|
|
|
typedef uint32_t (*StringGetDataFunc)(const nsAString&, const char16_t**,
|
|
|
|
bool*);
|
|
|
|
typedef uint32_t (*StringGetMutableDataFunc)(nsAString&, uint32_t,
|
|
|
|
char16_t**);
|
|
|
|
typedef char16_t* (*StringCloneDataFunc)(const nsAString&);
|
|
|
|
typedef nsresult (*StringSetDataFunc)(nsAString&, const char16_t*, uint32_t);
|
|
|
|
typedef nsresult (*StringSetDataRangeFunc)(nsAString&, uint32_t, uint32_t,
|
|
|
|
const char16_t*, uint32_t);
|
|
|
|
typedef nsresult (*StringCopyFunc)(nsAString&, const nsAString&);
|
|
|
|
typedef void (*StringSetIsVoidFunc)(nsAString&, const bool);
|
|
|
|
typedef bool (*StringGetIsVoidFunc)(const nsAString&);
|
|
|
|
|
|
|
|
typedef nsresult (*CStringContainerInitFunc)(nsCStringContainer&);
|
|
|
|
typedef nsresult (*CStringContainerInit2Func)(nsCStringContainer&,
|
|
|
|
const char*,
|
|
|
|
uint32_t, uint32_t);
|
|
|
|
typedef void (*CStringContainerFinishFunc)(nsCStringContainer&);
|
|
|
|
typedef uint32_t (*CStringGetDataFunc)(const nsACString&, const char**,
|
|
|
|
bool*);
|
|
|
|
typedef uint32_t (*CStringGetMutableDataFunc)(nsACString&, uint32_t, char**);
|
|
|
|
typedef char* (*CStringCloneDataFunc)(const nsACString&);
|
|
|
|
typedef nsresult (*CStringSetDataFunc)(nsACString&, const char*, uint32_t);
|
|
|
|
typedef nsresult (*CStringSetDataRangeFunc)(nsACString&, uint32_t, uint32_t,
|
|
|
|
const char*, uint32_t);
|
|
|
|
typedef nsresult (*CStringCopyFunc)(nsACString&, const nsACString&);
|
|
|
|
typedef void (*CStringSetIsVoidFunc)(nsACString&, const bool);
|
|
|
|
typedef bool (*CStringGetIsVoidFunc)(const nsACString&);
|
|
|
|
|
|
|
|
typedef nsresult (*CStringToUTF16)(const nsACString&, nsCStringEncoding,
|
|
|
|
nsAString&);
|
|
|
|
typedef nsresult (*UTF16ToCString)(const nsAString&, nsCStringEncoding,
|
|
|
|
nsACString&);
|
|
|
|
|
|
|
|
typedef void* (*AllocFunc)(size_t aSize);
|
|
|
|
typedef void* (*ReallocFunc)(void* aPtr, size_t aSize);
|
|
|
|
typedef void (*FreeFunc)(void* aPtr);
|
|
|
|
|
|
|
|
typedef void (*DebugBreakFunc)(uint32_t aSeverity,
|
|
|
|
const char* aStr, const char* aExpr,
|
|
|
|
const char* aFile, int32_t aLine);
|
|
|
|
|
|
|
|
typedef void (*xpcomVoidFunc)();
|
|
|
|
typedef void (*LogAddRefFunc)(void*, nsrefcnt, const char*, uint32_t);
|
|
|
|
typedef void (*LogReleaseFunc)(void*, nsrefcnt, const char*);
|
|
|
|
typedef void (*LogCtorFunc)(void*, const char*, uint32_t);
|
|
|
|
typedef void (*LogCOMPtrFunc)(void*, nsISupports*);
|
|
|
|
|
|
|
|
typedef nsresult (*GetXPTCallStubFunc)(REFNSIID, nsIXPTCProxy*,
|
|
|
|
nsISomeInterface**);
|
|
|
|
typedef void (*DestroyXPTCallStubFunc)(nsISomeInterface*);
|
|
|
|
typedef nsresult (*InvokeByIndexFunc)(nsISupports*, uint32_t, uint32_t,
|
|
|
|
nsXPTCVariant*);
|
|
|
|
typedef bool (*CycleCollectorFunc)(nsISupports*);
|
2009-05-07 00:46:04 +04:00
|
|
|
typedef nsPurpleBufferEntry*
|
2014-08-13 22:45:37 +04:00
|
|
|
(*CycleCollectorSuspect2Func)(void*,
|
|
|
|
nsCycleCollectionParticipant*);
|
|
|
|
typedef bool (*CycleCollectorForget2Func)(nsPurpleBufferEntry*);
|
|
|
|
typedef void (*CycleCollectorSuspect3Func)(void*,
|
|
|
|
nsCycleCollectionParticipant*,
|
|
|
|
nsCycleCollectingAutoRefCnt*,
|
|
|
|
bool*);
|
2006-02-13 19:08:55 +03:00
|
|
|
// PRIVATE AND DEPRECATED
|
|
|
|
typedef NS_CALLBACK(XPCOMExitRoutine)(void);
|
|
|
|
|
2014-08-13 22:45:37 +04:00
|
|
|
typedef nsresult (*RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine aExitRoutine,
|
|
|
|
uint32_t aPriority);
|
|
|
|
typedef nsresult (*UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine aExitRoutine);
|
|
|
|
|
|
|
|
typedef struct XPCOMFunctions
|
|
|
|
{
|
|
|
|
uint32_t version;
|
|
|
|
uint32_t size;
|
|
|
|
|
|
|
|
InitFunc init;
|
|
|
|
ShutdownFunc shutdown;
|
|
|
|
GetServiceManagerFunc getServiceManager;
|
|
|
|
GetComponentManagerFunc getComponentManager;
|
|
|
|
GetComponentRegistrarFunc getComponentRegistrar;
|
|
|
|
GetMemoryManagerFunc getMemoryManager;
|
|
|
|
NewLocalFileFunc newLocalFile;
|
|
|
|
NewNativeLocalFileFunc newNativeLocalFile;
|
|
|
|
|
|
|
|
RegisterXPCOMExitRoutineFunc registerExitRoutine;
|
|
|
|
UnregisterXPCOMExitRoutineFunc unregisterExitRoutine;
|
|
|
|
|
|
|
|
// Added for Mozilla 1.5
|
|
|
|
GetDebugFunc getDebug;
|
|
|
|
void* getTraceRefcnt;
|
|
|
|
|
|
|
|
// Added for Mozilla 1.7
|
|
|
|
StringContainerInitFunc stringContainerInit;
|
|
|
|
StringContainerFinishFunc stringContainerFinish;
|
|
|
|
StringGetDataFunc stringGetData;
|
|
|
|
StringSetDataFunc stringSetData;
|
|
|
|
StringSetDataRangeFunc stringSetDataRange;
|
|
|
|
StringCopyFunc stringCopy;
|
|
|
|
CStringContainerInitFunc cstringContainerInit;
|
|
|
|
CStringContainerFinishFunc cstringContainerFinish;
|
|
|
|
CStringGetDataFunc cstringGetData;
|
|
|
|
CStringSetDataFunc cstringSetData;
|
|
|
|
CStringSetDataRangeFunc cstringSetDataRange;
|
|
|
|
CStringCopyFunc cstringCopy;
|
|
|
|
CStringToUTF16 cstringToUTF16;
|
|
|
|
UTF16ToCString utf16ToCString;
|
|
|
|
StringCloneDataFunc stringCloneData;
|
|
|
|
CStringCloneDataFunc cstringCloneData;
|
|
|
|
|
|
|
|
// Added for Mozilla 1.8
|
|
|
|
AllocFunc allocFunc;
|
|
|
|
ReallocFunc reallocFunc;
|
|
|
|
FreeFunc freeFunc;
|
|
|
|
StringContainerInit2Func stringContainerInit2;
|
|
|
|
CStringContainerInit2Func cstringContainerInit2;
|
|
|
|
StringGetMutableDataFunc stringGetMutableData;
|
|
|
|
CStringGetMutableDataFunc cstringGetMutableData;
|
|
|
|
void* init3; // obsolete
|
|
|
|
|
|
|
|
// Added for Mozilla 1.9
|
|
|
|
DebugBreakFunc debugBreakFunc;
|
|
|
|
xpcomVoidFunc logInitFunc;
|
|
|
|
xpcomVoidFunc logTermFunc;
|
|
|
|
LogAddRefFunc logAddRefFunc;
|
|
|
|
LogReleaseFunc logReleaseFunc;
|
|
|
|
LogCtorFunc logCtorFunc;
|
|
|
|
LogCtorFunc logDtorFunc;
|
|
|
|
LogCOMPtrFunc logCOMPtrAddRefFunc;
|
|
|
|
LogCOMPtrFunc logCOMPtrReleaseFunc;
|
|
|
|
GetXPTCallStubFunc getXPTCallStubFunc;
|
|
|
|
DestroyXPTCallStubFunc destroyXPTCallStubFunc;
|
|
|
|
InvokeByIndexFunc invokeByIndexFunc;
|
|
|
|
CycleCollectorFunc cycleSuspectFunc; // obsolete: use cycleSuspect3Func
|
|
|
|
CycleCollectorFunc cycleForgetFunc; // obsolete
|
|
|
|
StringSetIsVoidFunc stringSetIsVoid;
|
|
|
|
StringGetIsVoidFunc stringGetIsVoid;
|
|
|
|
CStringSetIsVoidFunc cstringSetIsVoid;
|
|
|
|
CStringGetIsVoidFunc cstringGetIsVoid;
|
|
|
|
|
|
|
|
// Added for Mozilla 1.9.1
|
|
|
|
CycleCollectorSuspect2Func cycleSuspect2Func; // obsolete: use cycleSuspect3Func
|
|
|
|
CycleCollectorForget2Func cycleForget2Func; // obsolete
|
|
|
|
|
|
|
|
CycleCollectorSuspect3Func cycleSuspect3Func;
|
2013-07-09 21:30:58 +04:00
|
|
|
|
2002-06-21 23:58:54 +04:00
|
|
|
} XPCOMFunctions;
|
|
|
|
|
2014-08-13 22:45:37 +04:00
|
|
|
typedef nsresult (*GetFrozenFunctionsFunc)(XPCOMFunctions* aEntryPoints,
|
|
|
|
const char* aLibraryPath);
|
|
|
|
XPCOM_API(nsresult) NS_GetFrozenFunctions(XPCOMFunctions* aEntryPoints,
|
|
|
|
const char* aLibraryPath);
|
2002-06-21 23:58:54 +04:00
|
|
|
|
2009-06-16 23:36:44 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Shutdown XPCOM. You must call this method after you are finished
|
2014-08-13 22:45:37 +04:00
|
|
|
* using xpcom.
|
2009-06-16 23:36:44 +04:00
|
|
|
*
|
2014-08-13 22:45:37 +04:00
|
|
|
* @param aServMgr The service manager which was returned by NS_InitXPCOM.
|
2009-06-16 23:36:44 +04:00
|
|
|
* This will release servMgr. You may pass null.
|
|
|
|
*
|
|
|
|
* @return NS_OK for success;
|
|
|
|
* other error codes indicate a failure during shutdown
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
nsresult
|
2014-08-13 22:45:37 +04:00
|
|
|
ShutdownXPCOM(nsIServiceManager* aServMgr);
|
2009-06-16 23:36:44 +04:00
|
|
|
|
2014-02-11 10:35:32 +04:00
|
|
|
void SetICUMemoryFunctions();
|
|
|
|
|
2010-02-04 01:17:09 +03:00
|
|
|
/**
|
|
|
|
* C++ namespaced version of NS_LogTerm.
|
|
|
|
*/
|
|
|
|
void LogTerm();
|
|
|
|
|
2009-06-16 23:36:44 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
|
2002-06-21 23:58:54 +04:00
|
|
|
// think hard before changing this
|
|
|
|
#define XPCOM_GLUE_VERSION 1
|
|
|
|
|
2003-01-03 02:09:30 +03:00
|
|
|
|
|
|
|
/* XPCOM Specific Defines
|
|
|
|
*
|
2014-08-13 22:45:37 +04:00
|
|
|
* XPCOM_DLL - name of the loadable xpcom library on disk.
|
2005-11-18 20:45:59 +03:00
|
|
|
* XUL_DLL - name of the loadable XUL library on disk
|
2014-08-13 22:45:37 +04:00
|
|
|
* XPCOM_SEARCH_KEY - name of the environment variable that can be
|
2003-11-17 09:13:49 +03:00
|
|
|
* modified to include additional search paths.
|
2003-03-12 11:35:57 +03:00
|
|
|
* GRE_CONF_NAME - Name of the GRE Configuration file
|
2003-01-03 02:09:30 +03:00
|
|
|
*/
|
|
|
|
|
2014-02-11 02:57:01 +04:00
|
|
|
#if defined(XP_WIN32)
|
2003-01-03 02:09:30 +03:00
|
|
|
|
|
|
|
#define XPCOM_SEARCH_KEY "PATH"
|
|
|
|
#define GRE_CONF_NAME "gre.config"
|
2008-12-03 16:41:12 +03:00
|
|
|
#define GRE_WIN_REG_LOC L"Software\\mozilla.org\\GRE"
|
2013-03-20 17:56:41 +04:00
|
|
|
#define XPCOM_DLL XUL_DLL
|
|
|
|
#define LXPCOM_DLL LXUL_DLL
|
2005-11-18 20:45:59 +03:00
|
|
|
#define XUL_DLL "xul.dll"
|
2008-12-03 16:41:12 +03:00
|
|
|
#define LXUL_DLL L"xul.dll"
|
2003-01-03 04:39:38 +03:00
|
|
|
|
|
|
|
#else // Unix
|
2008-10-21 07:55:57 +04:00
|
|
|
#include <limits.h> // for PATH_MAX
|
2003-01-03 02:09:30 +03:00
|
|
|
|
2013-03-20 17:56:41 +04:00
|
|
|
#define XPCOM_DLL XUL_DLL
|
2003-04-20 21:59:47 +04:00
|
|
|
|
2003-01-03 02:09:30 +03:00
|
|
|
// you have to love apple..
|
2014-08-13 22:45:37 +04:00
|
|
|
#ifdef XP_MACOSX
|
2003-01-03 04:39:38 +03:00
|
|
|
#define XPCOM_SEARCH_KEY "DYLD_LIBRARY_PATH"
|
2005-10-09 22:20:03 +04:00
|
|
|
#define GRE_FRAMEWORK_NAME "XUL.framework"
|
2005-11-18 20:45:59 +03:00
|
|
|
#define XUL_DLL "XUL"
|
2003-01-03 02:09:30 +03:00
|
|
|
#else
|
2003-01-03 04:39:38 +03:00
|
|
|
#define XPCOM_SEARCH_KEY "LD_LIBRARY_PATH"
|
2011-11-08 13:33:56 +04:00
|
|
|
#define XUL_DLL "libxul" MOZ_DLL_SUFFIX
|
2003-01-03 02:09:30 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#define GRE_CONF_NAME ".gre.config"
|
|
|
|
#define GRE_CONF_PATH "/etc/gre.conf"
|
2005-06-16 17:29:45 +04:00
|
|
|
#define GRE_CONF_DIR "/etc/gre.d"
|
|
|
|
#define GRE_USER_CONF_DIR ".gre.d"
|
2003-01-03 02:09:30 +03:00
|
|
|
#endif
|
|
|
|
|
2014-02-11 02:57:01 +04:00
|
|
|
#if defined(XP_WIN)
|
2003-01-03 02:09:30 +03:00
|
|
|
#define XPCOM_FILE_PATH_SEPARATOR "\\"
|
2003-11-17 09:13:49 +03:00
|
|
|
#define XPCOM_ENV_PATH_SEPARATOR ";"
|
Bug 627277 - Remove (broken) BeOS support. r=biesi,dwitte,gavin,joe,jorendorff,josh,khuey,mfinkle,neil,Pike,roc,shaver,smontagu,taras
2011-02-19 22:10:24 +03:00
|
|
|
#elif defined(XP_UNIX)
|
2003-01-03 02:09:30 +03:00
|
|
|
#define XPCOM_FILE_PATH_SEPARATOR "/"
|
2003-11-17 09:13:49 +03:00
|
|
|
#define XPCOM_ENV_PATH_SEPARATOR ":"
|
2003-01-03 02:09:30 +03:00
|
|
|
#else
|
|
|
|
#error need_to_define_your_file_path_separator_and_illegal_characters
|
|
|
|
#endif
|
|
|
|
|
2005-06-14 06:37:32 +04:00
|
|
|
#ifdef AIX
|
|
|
|
#include <sys/param.h>
|
|
|
|
#endif
|
|
|
|
|
2005-06-13 20:45:22 +04:00
|
|
|
#ifndef MAXPATHLEN
|
2005-07-15 16:07:47 +04:00
|
|
|
#ifdef PATH_MAX
|
|
|
|
#define MAXPATHLEN PATH_MAX
|
|
|
|
#elif defined(_MAX_PATH)
|
2005-06-13 20:45:22 +04:00
|
|
|
#define MAXPATHLEN _MAX_PATH
|
|
|
|
#elif defined(CCHMAXPATH)
|
|
|
|
#define MAXPATHLEN CCHMAXPATH
|
|
|
|
#else
|
|
|
|
#define MAXPATHLEN 1024
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
extern bool gXPCOMShuttingDown;
|
2013-07-08 00:23:43 +04:00
|
|
|
extern bool gXPCOMThreadsShutDown;
|
2014-10-10 23:06:57 +04:00
|
|
|
|
|
|
|
// Needed by the IPC layer from off the main thread
|
|
|
|
extern char16_t* gGREBinPath;
|
2010-04-02 22:38:25 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace services {
|
|
|
|
|
2014-07-17 19:15:09 +04:00
|
|
|
/**
|
2010-04-02 22:38:25 +04:00
|
|
|
* Clears service cache, sets gXPCOMShuttingDown
|
|
|
|
*/
|
|
|
|
void Shutdown();
|
|
|
|
|
|
|
|
} // namespace services
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2005-07-21 17:33:43 +04:00
|
|
|
#endif
|