1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/xpcom/build/nsXPCOMPrivate.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,290 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* vim:set ts=4 sw=4 et cindent: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef nsXPComPrivate_h__ 1.11 +#define nsXPComPrivate_h__ 1.12 + 1.13 +#include "nscore.h" 1.14 +#include "nsXPCOM.h" 1.15 +#include "nsXPCOMStrings.h" 1.16 +#include "xptcall.h" 1.17 + 1.18 +class nsStringContainer; 1.19 +class nsCStringContainer; 1.20 +class nsIComponentLoader; 1.21 +class nsPurpleBufferEntry; 1.22 + 1.23 +/** 1.24 + * During this shutdown notification all threads which run XPCOM code must 1.25 + * be joined. 1.26 + */ 1.27 +#define NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID "xpcom-shutdown-threads" 1.28 + 1.29 +/** 1.30 + * During this shutdown notification all module loaders must unload XPCOM 1.31 + * modules. 1.32 + */ 1.33 +#define NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID "xpcom-shutdown-loaders" 1.34 + 1.35 +// PUBLIC 1.36 +typedef nsresult (* InitFunc)(nsIServiceManager* *result, nsIFile* binDirectory, nsIDirectoryServiceProvider* appFileLocationProvider); 1.37 +typedef nsresult (* ShutdownFunc)(nsIServiceManager* servMgr); 1.38 +typedef nsresult (* GetServiceManagerFunc)(nsIServiceManager* *result); 1.39 +typedef nsresult (* GetComponentManagerFunc)(nsIComponentManager* *result); 1.40 +typedef nsresult (* GetComponentRegistrarFunc)(nsIComponentRegistrar* *result); 1.41 +typedef nsresult (* GetMemoryManagerFunc)(nsIMemory* *result); 1.42 +typedef nsresult (* NewLocalFileFunc)(const nsAString &path, bool followLinks, nsIFile* *result); 1.43 +typedef nsresult (* NewNativeLocalFileFunc)(const nsACString &path, bool followLinks, nsIFile* *result); 1.44 + 1.45 +typedef nsresult (* GetDebugFunc)(nsIDebug* *result); 1.46 + 1.47 +typedef nsresult (* StringContainerInitFunc)(nsStringContainer&); 1.48 +typedef nsresult (* StringContainerInit2Func)(nsStringContainer&, const char16_t *, uint32_t, uint32_t); 1.49 +typedef void (* StringContainerFinishFunc)(nsStringContainer&); 1.50 +typedef uint32_t (* StringGetDataFunc)(const nsAString&, const char16_t**, bool*); 1.51 +typedef uint32_t (* StringGetMutableDataFunc)(nsAString&, uint32_t, char16_t**); 1.52 +typedef char16_t* (* StringCloneDataFunc)(const nsAString&); 1.53 +typedef nsresult (* StringSetDataFunc)(nsAString&, const char16_t*, uint32_t); 1.54 +typedef nsresult (* StringSetDataRangeFunc)(nsAString&, uint32_t, uint32_t, const char16_t*, uint32_t); 1.55 +typedef nsresult (* StringCopyFunc)(nsAString &, const nsAString &); 1.56 +typedef void (* StringSetIsVoidFunc)(nsAString &, const bool); 1.57 +typedef bool (* StringGetIsVoidFunc)(const nsAString &); 1.58 + 1.59 +typedef nsresult (* CStringContainerInitFunc)(nsCStringContainer&); 1.60 +typedef nsresult (* CStringContainerInit2Func)(nsCStringContainer&, const char *, uint32_t, uint32_t); 1.61 +typedef void (* CStringContainerFinishFunc)(nsCStringContainer&); 1.62 +typedef uint32_t (* CStringGetDataFunc)(const nsACString&, const char**, bool*); 1.63 +typedef uint32_t (* CStringGetMutableDataFunc)(nsACString&, uint32_t, char**); 1.64 +typedef char* (* CStringCloneDataFunc)(const nsACString&); 1.65 +typedef nsresult (* CStringSetDataFunc)(nsACString&, const char*, uint32_t); 1.66 +typedef nsresult (* CStringSetDataRangeFunc)(nsACString&, uint32_t, uint32_t, const char*, uint32_t); 1.67 +typedef nsresult (* CStringCopyFunc)(nsACString &, const nsACString &); 1.68 +typedef void (* CStringSetIsVoidFunc)(nsACString &, const bool); 1.69 +typedef bool (* CStringGetIsVoidFunc)(const nsACString &); 1.70 + 1.71 +typedef nsresult (* CStringToUTF16)(const nsACString &, nsCStringEncoding, nsAString &); 1.72 +typedef nsresult (* UTF16ToCString)(const nsAString &, nsCStringEncoding, nsACString &); 1.73 + 1.74 +typedef void* (* AllocFunc)(size_t size); 1.75 +typedef void* (* ReallocFunc)(void* ptr, size_t size); 1.76 +typedef void (* FreeFunc)(void* ptr); 1.77 + 1.78 +typedef void (* DebugBreakFunc)(uint32_t aSeverity, 1.79 + const char *aStr, const char *aExpr, 1.80 + const char *aFile, int32_t aLine); 1.81 + 1.82 +typedef void (* xpcomVoidFunc)(); 1.83 +typedef void (* LogAddRefFunc)(void*, nsrefcnt, const char*, uint32_t); 1.84 +typedef void (* LogReleaseFunc)(void*, nsrefcnt, const char*); 1.85 +typedef void (* LogCtorFunc)(void*, const char*, uint32_t); 1.86 +typedef void (* LogCOMPtrFunc)(void*, nsISupports*); 1.87 + 1.88 +typedef nsresult (* GetXPTCallStubFunc)(REFNSIID, nsIXPTCProxy*, nsISomeInterface**); 1.89 +typedef void (* DestroyXPTCallStubFunc)(nsISomeInterface*); 1.90 +typedef nsresult (* InvokeByIndexFunc)(nsISupports*, uint32_t, uint32_t, nsXPTCVariant*); 1.91 +typedef bool (* CycleCollectorFunc)(nsISupports*); 1.92 +typedef nsPurpleBufferEntry* 1.93 + (* CycleCollectorSuspect2Func)(void*, nsCycleCollectionParticipant*); 1.94 +typedef bool (* CycleCollectorForget2Func)(nsPurpleBufferEntry*); 1.95 +typedef void (* CycleCollectorSuspect3Func)(void*, nsCycleCollectionParticipant*,nsCycleCollectingAutoRefCnt*,bool*); 1.96 +// PRIVATE AND DEPRECATED 1.97 +typedef NS_CALLBACK(XPCOMExitRoutine)(void); 1.98 + 1.99 +typedef nsresult (* RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine, uint32_t priority); 1.100 +typedef nsresult (* UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine); 1.101 + 1.102 +typedef struct XPCOMFunctions{ 1.103 + uint32_t version; 1.104 + uint32_t size; 1.105 + 1.106 + InitFunc init; 1.107 + ShutdownFunc shutdown; 1.108 + GetServiceManagerFunc getServiceManager; 1.109 + GetComponentManagerFunc getComponentManager; 1.110 + GetComponentRegistrarFunc getComponentRegistrar; 1.111 + GetMemoryManagerFunc getMemoryManager; 1.112 + NewLocalFileFunc newLocalFile; 1.113 + NewNativeLocalFileFunc newNativeLocalFile; 1.114 + 1.115 + RegisterXPCOMExitRoutineFunc registerExitRoutine; 1.116 + UnregisterXPCOMExitRoutineFunc unregisterExitRoutine; 1.117 + 1.118 + // Added for Mozilla 1.5 1.119 + GetDebugFunc getDebug; 1.120 + void* getTraceRefcnt; 1.121 + 1.122 + // Added for Mozilla 1.7 1.123 + StringContainerInitFunc stringContainerInit; 1.124 + StringContainerFinishFunc stringContainerFinish; 1.125 + StringGetDataFunc stringGetData; 1.126 + StringSetDataFunc stringSetData; 1.127 + StringSetDataRangeFunc stringSetDataRange; 1.128 + StringCopyFunc stringCopy; 1.129 + CStringContainerInitFunc cstringContainerInit; 1.130 + CStringContainerFinishFunc cstringContainerFinish; 1.131 + CStringGetDataFunc cstringGetData; 1.132 + CStringSetDataFunc cstringSetData; 1.133 + CStringSetDataRangeFunc cstringSetDataRange; 1.134 + CStringCopyFunc cstringCopy; 1.135 + CStringToUTF16 cstringToUTF16; 1.136 + UTF16ToCString utf16ToCString; 1.137 + StringCloneDataFunc stringCloneData; 1.138 + CStringCloneDataFunc cstringCloneData; 1.139 + 1.140 + // Added for Mozilla 1.8 1.141 + AllocFunc allocFunc; 1.142 + ReallocFunc reallocFunc; 1.143 + FreeFunc freeFunc; 1.144 + StringContainerInit2Func stringContainerInit2; 1.145 + CStringContainerInit2Func cstringContainerInit2; 1.146 + StringGetMutableDataFunc stringGetMutableData; 1.147 + CStringGetMutableDataFunc cstringGetMutableData; 1.148 + void* init3; // obsolete 1.149 + 1.150 + // Added for Mozilla 1.9 1.151 + DebugBreakFunc debugBreakFunc; 1.152 + xpcomVoidFunc logInitFunc; 1.153 + xpcomVoidFunc logTermFunc; 1.154 + LogAddRefFunc logAddRefFunc; 1.155 + LogReleaseFunc logReleaseFunc; 1.156 + LogCtorFunc logCtorFunc; 1.157 + LogCtorFunc logDtorFunc; 1.158 + LogCOMPtrFunc logCOMPtrAddRefFunc; 1.159 + LogCOMPtrFunc logCOMPtrReleaseFunc; 1.160 + GetXPTCallStubFunc getXPTCallStubFunc; 1.161 + DestroyXPTCallStubFunc destroyXPTCallStubFunc; 1.162 + InvokeByIndexFunc invokeByIndexFunc; 1.163 + CycleCollectorFunc cycleSuspectFunc; // obsolete: use cycleSuspect3Func 1.164 + CycleCollectorFunc cycleForgetFunc; // obsolete 1.165 + StringSetIsVoidFunc stringSetIsVoid; 1.166 + StringGetIsVoidFunc stringGetIsVoid; 1.167 + CStringSetIsVoidFunc cstringSetIsVoid; 1.168 + CStringGetIsVoidFunc cstringGetIsVoid; 1.169 + 1.170 + // Added for Mozilla 1.9.1 1.171 + CycleCollectorSuspect2Func cycleSuspect2Func; // obsolete: use cycleSuspect3Func 1.172 + CycleCollectorForget2Func cycleForget2Func; // obsolete 1.173 + 1.174 + CycleCollectorSuspect3Func cycleSuspect3Func; 1.175 + 1.176 +} XPCOMFunctions; 1.177 + 1.178 +typedef nsresult (*GetFrozenFunctionsFunc)(XPCOMFunctions *entryPoints, const char* libraryPath); 1.179 +XPCOM_API(nsresult) 1.180 +NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath); 1.181 + 1.182 + 1.183 +namespace mozilla { 1.184 + 1.185 +/** 1.186 + * Shutdown XPCOM. You must call this method after you are finished 1.187 + * using xpcom. 1.188 + * 1.189 + * @param servMgr The service manager which was returned by NS_InitXPCOM. 1.190 + * This will release servMgr. You may pass null. 1.191 + * 1.192 + * @return NS_OK for success; 1.193 + * other error codes indicate a failure during shutdown 1.194 + * 1.195 + */ 1.196 +nsresult 1.197 +ShutdownXPCOM(nsIServiceManager* servMgr); 1.198 + 1.199 +void SetICUMemoryFunctions(); 1.200 + 1.201 +/** 1.202 + * C++ namespaced version of NS_LogTerm. 1.203 + */ 1.204 +void LogTerm(); 1.205 + 1.206 +} // namespace mozilla 1.207 + 1.208 + 1.209 +// think hard before changing this 1.210 +#define XPCOM_GLUE_VERSION 1 1.211 + 1.212 + 1.213 +/* XPCOM Specific Defines 1.214 + * 1.215 + * XPCOM_DLL - name of the loadable xpcom library on disk. 1.216 + * XUL_DLL - name of the loadable XUL library on disk 1.217 + * XPCOM_SEARCH_KEY - name of the environment variable that can be 1.218 + * modified to include additional search paths. 1.219 + * GRE_CONF_NAME - Name of the GRE Configuration file 1.220 + */ 1.221 + 1.222 +#if defined(XP_WIN32) 1.223 + 1.224 +#define XPCOM_SEARCH_KEY "PATH" 1.225 +#define GRE_CONF_NAME "gre.config" 1.226 +#define GRE_WIN_REG_LOC L"Software\\mozilla.org\\GRE" 1.227 +#define XPCOM_DLL XUL_DLL 1.228 +#define LXPCOM_DLL LXUL_DLL 1.229 +#define XUL_DLL "xul.dll" 1.230 +#define LXUL_DLL L"xul.dll" 1.231 + 1.232 +#else // Unix 1.233 +#include <limits.h> // for PATH_MAX 1.234 + 1.235 +#define XPCOM_DLL XUL_DLL 1.236 + 1.237 +// you have to love apple.. 1.238 +#ifdef XP_MACOSX 1.239 +#define XPCOM_SEARCH_KEY "DYLD_LIBRARY_PATH" 1.240 +#define GRE_FRAMEWORK_NAME "XUL.framework" 1.241 +#define XUL_DLL "XUL" 1.242 +#else 1.243 +#define XPCOM_SEARCH_KEY "LD_LIBRARY_PATH" 1.244 +#define XUL_DLL "libxul" MOZ_DLL_SUFFIX 1.245 +#endif 1.246 + 1.247 +#define GRE_CONF_NAME ".gre.config" 1.248 +#define GRE_CONF_PATH "/etc/gre.conf" 1.249 +#define GRE_CONF_DIR "/etc/gre.d" 1.250 +#define GRE_USER_CONF_DIR ".gre.d" 1.251 +#endif 1.252 + 1.253 +#if defined(XP_WIN) 1.254 + #define XPCOM_FILE_PATH_SEPARATOR "\\" 1.255 + #define XPCOM_ENV_PATH_SEPARATOR ";" 1.256 +#elif defined(XP_UNIX) 1.257 + #define XPCOM_FILE_PATH_SEPARATOR "/" 1.258 + #define XPCOM_ENV_PATH_SEPARATOR ":" 1.259 +#else 1.260 + #error need_to_define_your_file_path_separator_and_illegal_characters 1.261 +#endif 1.262 + 1.263 +#ifdef AIX 1.264 +#include <sys/param.h> 1.265 +#endif 1.266 + 1.267 +#ifndef MAXPATHLEN 1.268 +#ifdef PATH_MAX 1.269 +#define MAXPATHLEN PATH_MAX 1.270 +#elif defined(_MAX_PATH) 1.271 +#define MAXPATHLEN _MAX_PATH 1.272 +#elif defined(CCHMAXPATH) 1.273 +#define MAXPATHLEN CCHMAXPATH 1.274 +#else 1.275 +#define MAXPATHLEN 1024 1.276 +#endif 1.277 +#endif 1.278 + 1.279 +extern bool gXPCOMShuttingDown; 1.280 +extern bool gXPCOMThreadsShutDown; 1.281 + 1.282 +namespace mozilla { 1.283 +namespace services { 1.284 + 1.285 +/** 1.286 + * Clears service cache, sets gXPCOMShuttingDown 1.287 + */ 1.288 +void Shutdown(); 1.289 + 1.290 +} // namespace services 1.291 +} // namespace mozilla 1.292 + 1.293 +#endif