1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef nsXPCOMPrivate_h__ 8 #define nsXPCOMPrivate_h__ 9 10 #include "nscore.h" 11 #include "nsXPCOM.h" 12 #include "mozilla/Attributes.h" 13 14 /** 15 * During this shutdown notification all threads which run XPCOM code must 16 * be joined. 17 */ 18 #define NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID "xpcom-shutdown-threads" 19 20 // PUBLIC 21 namespace mozilla { 22 23 /** 24 * Shutdown XPCOM. You must call this method after you are finished 25 * using xpcom. 26 * 27 * @param aServMgr The service manager which was returned by 28 * NS_InitXPCOM. This will release servMgr. You may pass null. 29 * 30 * @return NS_OK for success; 31 * other error codes indicate a failure during shutdown 32 * 33 */ 34 MOZ_CAN_RUN_SCRIPT 35 nsresult ShutdownXPCOM(nsIServiceManager* aServMgr); 36 37 void SetICUMemoryFunctions(); 38 39 /** 40 * C++ namespaced version of NS_LogTerm. 41 */ 42 void LogTerm(); 43 44 } // namespace mozilla 45 46 /* XPCOM Specific Defines 47 * 48 * XPCOM_DLL - name of the loadable xpcom library on disk. 49 * XUL_DLL - name of the loadable XUL library on disk 50 * XPCOM_SEARCH_KEY - name of the environment variable that can be 51 * modified to include additional search paths. 52 * GRE_CONF_NAME - Name of the GRE Configuration file 53 */ 54 55 #if defined(XP_WIN) 56 57 # define XPCOM_SEARCH_KEY "PATH" 58 # define GRE_CONF_NAME "gre.config" 59 # define GRE_WIN_REG_LOC L"Software\\mozilla.org\\GRE" 60 # define XPCOM_DLL XUL_DLL 61 # define LXPCOM_DLL LXUL_DLL 62 # define XUL_DLL "xul.dll" 63 # define LXUL_DLL L"xul.dll" 64 65 #else // Unix 66 # include <limits.h> // for PATH_MAX 67 68 # define XPCOM_DLL XUL_DLL 69 70 // you have to love apple.. 71 # ifdef XP_MACOSX 72 # define XPCOM_SEARCH_KEY "DYLD_LIBRARY_PATH" 73 # define GRE_FRAMEWORK_NAME "XUL.framework" 74 # define XUL_DLL "XUL" 75 # else 76 # define XPCOM_SEARCH_KEY "LD_LIBRARY_PATH" 77 # define XUL_DLL "libxul" MOZ_DLL_SUFFIX 78 # endif 79 80 # define GRE_CONF_NAME ".gre.config" 81 # define GRE_CONF_PATH "/usr/local/etc/gre.conf" 82 # define GRE_CONF_DIR "/usr/local/etc/gre.d" 83 # define GRE_USER_CONF_DIR ".gre.d" 84 #endif 85 86 #if defined(XP_WIN) 87 # define XPCOM_FILE_PATH_SEPARATOR "\\" 88 # define XPCOM_ENV_PATH_SEPARATOR ";" 89 #elif defined(XP_UNIX) 90 # define XPCOM_FILE_PATH_SEPARATOR "/" 91 # define XPCOM_ENV_PATH_SEPARATOR ":" 92 #else 93 # error need_to_define_your_file_path_separator_and_illegal_characters 94 #endif 95 96 #ifdef AIX 97 # include <sys/param.h> 98 #endif 99 100 #ifndef MAXPATHLEN 101 # ifdef PATH_MAX 102 # define MAXPATHLEN PATH_MAX 103 # elif defined(_MAX_PATH) 104 # define MAXPATHLEN _MAX_PATH 105 # elif defined(CCHMAXPATH) 106 # define MAXPATHLEN CCHMAXPATH 107 # else 108 # define MAXPATHLEN 1024 109 # endif 110 #endif 111 112 // Needed by the IPC layer from off the main thread 113 extern char16_t* gGREBinPath; 114 115 namespace mozilla { 116 namespace services { 117 118 /** 119 * Clears service cache, sets gXPCOMShuttingDown 120 */ 121 void Shutdown(); 122 123 } // namespace services 124 } // namespace mozilla 125 126 #endif 127