xpcom/build/nsXPCOMPrivate.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
michael@0 2 /* vim:set ts=4 sw=4 et cindent: */
michael@0 3 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 4 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 6
michael@0 7 #ifndef nsXPComPrivate_h__
michael@0 8 #define nsXPComPrivate_h__
michael@0 9
michael@0 10 #include "nscore.h"
michael@0 11 #include "nsXPCOM.h"
michael@0 12 #include "nsXPCOMStrings.h"
michael@0 13 #include "xptcall.h"
michael@0 14
michael@0 15 class nsStringContainer;
michael@0 16 class nsCStringContainer;
michael@0 17 class nsIComponentLoader;
michael@0 18 class nsPurpleBufferEntry;
michael@0 19
michael@0 20 /**
michael@0 21 * During this shutdown notification all threads which run XPCOM code must
michael@0 22 * be joined.
michael@0 23 */
michael@0 24 #define NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID "xpcom-shutdown-threads"
michael@0 25
michael@0 26 /**
michael@0 27 * During this shutdown notification all module loaders must unload XPCOM
michael@0 28 * modules.
michael@0 29 */
michael@0 30 #define NS_XPCOM_SHUTDOWN_LOADERS_OBSERVER_ID "xpcom-shutdown-loaders"
michael@0 31
michael@0 32 // PUBLIC
michael@0 33 typedef nsresult (* InitFunc)(nsIServiceManager* *result, nsIFile* binDirectory, nsIDirectoryServiceProvider* appFileLocationProvider);
michael@0 34 typedef nsresult (* ShutdownFunc)(nsIServiceManager* servMgr);
michael@0 35 typedef nsresult (* GetServiceManagerFunc)(nsIServiceManager* *result);
michael@0 36 typedef nsresult (* GetComponentManagerFunc)(nsIComponentManager* *result);
michael@0 37 typedef nsresult (* GetComponentRegistrarFunc)(nsIComponentRegistrar* *result);
michael@0 38 typedef nsresult (* GetMemoryManagerFunc)(nsIMemory* *result);
michael@0 39 typedef nsresult (* NewLocalFileFunc)(const nsAString &path, bool followLinks, nsIFile* *result);
michael@0 40 typedef nsresult (* NewNativeLocalFileFunc)(const nsACString &path, bool followLinks, nsIFile* *result);
michael@0 41
michael@0 42 typedef nsresult (* GetDebugFunc)(nsIDebug* *result);
michael@0 43
michael@0 44 typedef nsresult (* StringContainerInitFunc)(nsStringContainer&);
michael@0 45 typedef nsresult (* StringContainerInit2Func)(nsStringContainer&, const char16_t *, uint32_t, uint32_t);
michael@0 46 typedef void (* StringContainerFinishFunc)(nsStringContainer&);
michael@0 47 typedef uint32_t (* StringGetDataFunc)(const nsAString&, const char16_t**, bool*);
michael@0 48 typedef uint32_t (* StringGetMutableDataFunc)(nsAString&, uint32_t, char16_t**);
michael@0 49 typedef char16_t* (* StringCloneDataFunc)(const nsAString&);
michael@0 50 typedef nsresult (* StringSetDataFunc)(nsAString&, const char16_t*, uint32_t);
michael@0 51 typedef nsresult (* StringSetDataRangeFunc)(nsAString&, uint32_t, uint32_t, const char16_t*, uint32_t);
michael@0 52 typedef nsresult (* StringCopyFunc)(nsAString &, const nsAString &);
michael@0 53 typedef void (* StringSetIsVoidFunc)(nsAString &, const bool);
michael@0 54 typedef bool (* StringGetIsVoidFunc)(const nsAString &);
michael@0 55
michael@0 56 typedef nsresult (* CStringContainerInitFunc)(nsCStringContainer&);
michael@0 57 typedef nsresult (* CStringContainerInit2Func)(nsCStringContainer&, const char *, uint32_t, uint32_t);
michael@0 58 typedef void (* CStringContainerFinishFunc)(nsCStringContainer&);
michael@0 59 typedef uint32_t (* CStringGetDataFunc)(const nsACString&, const char**, bool*);
michael@0 60 typedef uint32_t (* CStringGetMutableDataFunc)(nsACString&, uint32_t, char**);
michael@0 61 typedef char* (* CStringCloneDataFunc)(const nsACString&);
michael@0 62 typedef nsresult (* CStringSetDataFunc)(nsACString&, const char*, uint32_t);
michael@0 63 typedef nsresult (* CStringSetDataRangeFunc)(nsACString&, uint32_t, uint32_t, const char*, uint32_t);
michael@0 64 typedef nsresult (* CStringCopyFunc)(nsACString &, const nsACString &);
michael@0 65 typedef void (* CStringSetIsVoidFunc)(nsACString &, const bool);
michael@0 66 typedef bool (* CStringGetIsVoidFunc)(const nsACString &);
michael@0 67
michael@0 68 typedef nsresult (* CStringToUTF16)(const nsACString &, nsCStringEncoding, nsAString &);
michael@0 69 typedef nsresult (* UTF16ToCString)(const nsAString &, nsCStringEncoding, nsACString &);
michael@0 70
michael@0 71 typedef void* (* AllocFunc)(size_t size);
michael@0 72 typedef void* (* ReallocFunc)(void* ptr, size_t size);
michael@0 73 typedef void (* FreeFunc)(void* ptr);
michael@0 74
michael@0 75 typedef void (* DebugBreakFunc)(uint32_t aSeverity,
michael@0 76 const char *aStr, const char *aExpr,
michael@0 77 const char *aFile, int32_t aLine);
michael@0 78
michael@0 79 typedef void (* xpcomVoidFunc)();
michael@0 80 typedef void (* LogAddRefFunc)(void*, nsrefcnt, const char*, uint32_t);
michael@0 81 typedef void (* LogReleaseFunc)(void*, nsrefcnt, const char*);
michael@0 82 typedef void (* LogCtorFunc)(void*, const char*, uint32_t);
michael@0 83 typedef void (* LogCOMPtrFunc)(void*, nsISupports*);
michael@0 84
michael@0 85 typedef nsresult (* GetXPTCallStubFunc)(REFNSIID, nsIXPTCProxy*, nsISomeInterface**);
michael@0 86 typedef void (* DestroyXPTCallStubFunc)(nsISomeInterface*);
michael@0 87 typedef nsresult (* InvokeByIndexFunc)(nsISupports*, uint32_t, uint32_t, nsXPTCVariant*);
michael@0 88 typedef bool (* CycleCollectorFunc)(nsISupports*);
michael@0 89 typedef nsPurpleBufferEntry*
michael@0 90 (* CycleCollectorSuspect2Func)(void*, nsCycleCollectionParticipant*);
michael@0 91 typedef bool (* CycleCollectorForget2Func)(nsPurpleBufferEntry*);
michael@0 92 typedef void (* CycleCollectorSuspect3Func)(void*, nsCycleCollectionParticipant*,nsCycleCollectingAutoRefCnt*,bool*);
michael@0 93 // PRIVATE AND DEPRECATED
michael@0 94 typedef NS_CALLBACK(XPCOMExitRoutine)(void);
michael@0 95
michael@0 96 typedef nsresult (* RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine, uint32_t priority);
michael@0 97 typedef nsresult (* UnregisterXPCOMExitRoutineFunc)(XPCOMExitRoutine exitRoutine);
michael@0 98
michael@0 99 typedef struct XPCOMFunctions{
michael@0 100 uint32_t version;
michael@0 101 uint32_t size;
michael@0 102
michael@0 103 InitFunc init;
michael@0 104 ShutdownFunc shutdown;
michael@0 105 GetServiceManagerFunc getServiceManager;
michael@0 106 GetComponentManagerFunc getComponentManager;
michael@0 107 GetComponentRegistrarFunc getComponentRegistrar;
michael@0 108 GetMemoryManagerFunc getMemoryManager;
michael@0 109 NewLocalFileFunc newLocalFile;
michael@0 110 NewNativeLocalFileFunc newNativeLocalFile;
michael@0 111
michael@0 112 RegisterXPCOMExitRoutineFunc registerExitRoutine;
michael@0 113 UnregisterXPCOMExitRoutineFunc unregisterExitRoutine;
michael@0 114
michael@0 115 // Added for Mozilla 1.5
michael@0 116 GetDebugFunc getDebug;
michael@0 117 void* getTraceRefcnt;
michael@0 118
michael@0 119 // Added for Mozilla 1.7
michael@0 120 StringContainerInitFunc stringContainerInit;
michael@0 121 StringContainerFinishFunc stringContainerFinish;
michael@0 122 StringGetDataFunc stringGetData;
michael@0 123 StringSetDataFunc stringSetData;
michael@0 124 StringSetDataRangeFunc stringSetDataRange;
michael@0 125 StringCopyFunc stringCopy;
michael@0 126 CStringContainerInitFunc cstringContainerInit;
michael@0 127 CStringContainerFinishFunc cstringContainerFinish;
michael@0 128 CStringGetDataFunc cstringGetData;
michael@0 129 CStringSetDataFunc cstringSetData;
michael@0 130 CStringSetDataRangeFunc cstringSetDataRange;
michael@0 131 CStringCopyFunc cstringCopy;
michael@0 132 CStringToUTF16 cstringToUTF16;
michael@0 133 UTF16ToCString utf16ToCString;
michael@0 134 StringCloneDataFunc stringCloneData;
michael@0 135 CStringCloneDataFunc cstringCloneData;
michael@0 136
michael@0 137 // Added for Mozilla 1.8
michael@0 138 AllocFunc allocFunc;
michael@0 139 ReallocFunc reallocFunc;
michael@0 140 FreeFunc freeFunc;
michael@0 141 StringContainerInit2Func stringContainerInit2;
michael@0 142 CStringContainerInit2Func cstringContainerInit2;
michael@0 143 StringGetMutableDataFunc stringGetMutableData;
michael@0 144 CStringGetMutableDataFunc cstringGetMutableData;
michael@0 145 void* init3; // obsolete
michael@0 146
michael@0 147 // Added for Mozilla 1.9
michael@0 148 DebugBreakFunc debugBreakFunc;
michael@0 149 xpcomVoidFunc logInitFunc;
michael@0 150 xpcomVoidFunc logTermFunc;
michael@0 151 LogAddRefFunc logAddRefFunc;
michael@0 152 LogReleaseFunc logReleaseFunc;
michael@0 153 LogCtorFunc logCtorFunc;
michael@0 154 LogCtorFunc logDtorFunc;
michael@0 155 LogCOMPtrFunc logCOMPtrAddRefFunc;
michael@0 156 LogCOMPtrFunc logCOMPtrReleaseFunc;
michael@0 157 GetXPTCallStubFunc getXPTCallStubFunc;
michael@0 158 DestroyXPTCallStubFunc destroyXPTCallStubFunc;
michael@0 159 InvokeByIndexFunc invokeByIndexFunc;
michael@0 160 CycleCollectorFunc cycleSuspectFunc; // obsolete: use cycleSuspect3Func
michael@0 161 CycleCollectorFunc cycleForgetFunc; // obsolete
michael@0 162 StringSetIsVoidFunc stringSetIsVoid;
michael@0 163 StringGetIsVoidFunc stringGetIsVoid;
michael@0 164 CStringSetIsVoidFunc cstringSetIsVoid;
michael@0 165 CStringGetIsVoidFunc cstringGetIsVoid;
michael@0 166
michael@0 167 // Added for Mozilla 1.9.1
michael@0 168 CycleCollectorSuspect2Func cycleSuspect2Func; // obsolete: use cycleSuspect3Func
michael@0 169 CycleCollectorForget2Func cycleForget2Func; // obsolete
michael@0 170
michael@0 171 CycleCollectorSuspect3Func cycleSuspect3Func;
michael@0 172
michael@0 173 } XPCOMFunctions;
michael@0 174
michael@0 175 typedef nsresult (*GetFrozenFunctionsFunc)(XPCOMFunctions *entryPoints, const char* libraryPath);
michael@0 176 XPCOM_API(nsresult)
michael@0 177 NS_GetFrozenFunctions(XPCOMFunctions *entryPoints, const char* libraryPath);
michael@0 178
michael@0 179
michael@0 180 namespace mozilla {
michael@0 181
michael@0 182 /**
michael@0 183 * Shutdown XPCOM. You must call this method after you are finished
michael@0 184 * using xpcom.
michael@0 185 *
michael@0 186 * @param servMgr The service manager which was returned by NS_InitXPCOM.
michael@0 187 * This will release servMgr. You may pass null.
michael@0 188 *
michael@0 189 * @return NS_OK for success;
michael@0 190 * other error codes indicate a failure during shutdown
michael@0 191 *
michael@0 192 */
michael@0 193 nsresult
michael@0 194 ShutdownXPCOM(nsIServiceManager* servMgr);
michael@0 195
michael@0 196 void SetICUMemoryFunctions();
michael@0 197
michael@0 198 /**
michael@0 199 * C++ namespaced version of NS_LogTerm.
michael@0 200 */
michael@0 201 void LogTerm();
michael@0 202
michael@0 203 } // namespace mozilla
michael@0 204
michael@0 205
michael@0 206 // think hard before changing this
michael@0 207 #define XPCOM_GLUE_VERSION 1
michael@0 208
michael@0 209
michael@0 210 /* XPCOM Specific Defines
michael@0 211 *
michael@0 212 * XPCOM_DLL - name of the loadable xpcom library on disk.
michael@0 213 * XUL_DLL - name of the loadable XUL library on disk
michael@0 214 * XPCOM_SEARCH_KEY - name of the environment variable that can be
michael@0 215 * modified to include additional search paths.
michael@0 216 * GRE_CONF_NAME - Name of the GRE Configuration file
michael@0 217 */
michael@0 218
michael@0 219 #if defined(XP_WIN32)
michael@0 220
michael@0 221 #define XPCOM_SEARCH_KEY "PATH"
michael@0 222 #define GRE_CONF_NAME "gre.config"
michael@0 223 #define GRE_WIN_REG_LOC L"Software\\mozilla.org\\GRE"
michael@0 224 #define XPCOM_DLL XUL_DLL
michael@0 225 #define LXPCOM_DLL LXUL_DLL
michael@0 226 #define XUL_DLL "xul.dll"
michael@0 227 #define LXUL_DLL L"xul.dll"
michael@0 228
michael@0 229 #else // Unix
michael@0 230 #include <limits.h> // for PATH_MAX
michael@0 231
michael@0 232 #define XPCOM_DLL XUL_DLL
michael@0 233
michael@0 234 // you have to love apple..
michael@0 235 #ifdef XP_MACOSX
michael@0 236 #define XPCOM_SEARCH_KEY "DYLD_LIBRARY_PATH"
michael@0 237 #define GRE_FRAMEWORK_NAME "XUL.framework"
michael@0 238 #define XUL_DLL "XUL"
michael@0 239 #else
michael@0 240 #define XPCOM_SEARCH_KEY "LD_LIBRARY_PATH"
michael@0 241 #define XUL_DLL "libxul" MOZ_DLL_SUFFIX
michael@0 242 #endif
michael@0 243
michael@0 244 #define GRE_CONF_NAME ".gre.config"
michael@0 245 #define GRE_CONF_PATH "/etc/gre.conf"
michael@0 246 #define GRE_CONF_DIR "/etc/gre.d"
michael@0 247 #define GRE_USER_CONF_DIR ".gre.d"
michael@0 248 #endif
michael@0 249
michael@0 250 #if defined(XP_WIN)
michael@0 251 #define XPCOM_FILE_PATH_SEPARATOR "\\"
michael@0 252 #define XPCOM_ENV_PATH_SEPARATOR ";"
michael@0 253 #elif defined(XP_UNIX)
michael@0 254 #define XPCOM_FILE_PATH_SEPARATOR "/"
michael@0 255 #define XPCOM_ENV_PATH_SEPARATOR ":"
michael@0 256 #else
michael@0 257 #error need_to_define_your_file_path_separator_and_illegal_characters
michael@0 258 #endif
michael@0 259
michael@0 260 #ifdef AIX
michael@0 261 #include <sys/param.h>
michael@0 262 #endif
michael@0 263
michael@0 264 #ifndef MAXPATHLEN
michael@0 265 #ifdef PATH_MAX
michael@0 266 #define MAXPATHLEN PATH_MAX
michael@0 267 #elif defined(_MAX_PATH)
michael@0 268 #define MAXPATHLEN _MAX_PATH
michael@0 269 #elif defined(CCHMAXPATH)
michael@0 270 #define MAXPATHLEN CCHMAXPATH
michael@0 271 #else
michael@0 272 #define MAXPATHLEN 1024
michael@0 273 #endif
michael@0 274 #endif
michael@0 275
michael@0 276 extern bool gXPCOMShuttingDown;
michael@0 277 extern bool gXPCOMThreadsShutDown;
michael@0 278
michael@0 279 namespace mozilla {
michael@0 280 namespace services {
michael@0 281
michael@0 282 /**
michael@0 283 * Clears service cache, sets gXPCOMShuttingDown
michael@0 284 */
michael@0 285 void Shutdown();
michael@0 286
michael@0 287 } // namespace services
michael@0 288 } // namespace mozilla
michael@0 289
michael@0 290 #endif

mercurial