summaryrefslogtreecommitdiffstats
path: root/xpcom/build/nsXPCOMPrivate.h
blob: 49f36c709cfa7c4a508433d60dbabc54c2b9341a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* 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/. */

#ifndef nsXPCOMPrivate_h__
#define nsXPCOMPrivate_h__

#include "nscore.h"
#include "nsXPCOM.h"
#include "mozilla/Attributes.h"

/**
 * During this shutdown notification all threads which run XPCOM code must
 * be joined.
 */
#define NS_XPCOM_SHUTDOWN_THREADS_OBSERVER_ID "xpcom-shutdown-threads"

// PUBLIC
namespace mozilla {

/**
 * Shutdown XPCOM. You must call this method after you are finished
 * using xpcom.
 *
 * @param aServMgr          The service manager which was returned by
 * NS_InitXPCOM. This will release servMgr.  You may pass null.
 *
 * @return NS_OK for success;
 *         other error codes indicate a failure during shutdown
 *
 */
MOZ_CAN_RUN_SCRIPT
nsresult ShutdownXPCOM(nsIServiceManager* aServMgr);

void SetICUMemoryFunctions();

/**
 * C++ namespaced version of NS_LogTerm.
 */
void LogTerm();

}  // namespace mozilla

/* XPCOM Specific Defines
 *
 * XPCOM_DLL              - name of the loadable xpcom library on disk.
 * XUL_DLL                - name of the loadable XUL library on disk
 * XPCOM_SEARCH_KEY       - name of the environment variable that can be
 *                          modified to include additional search paths.
 * GRE_CONF_NAME          - Name of the GRE Configuration file
 */

#if defined(XP_WIN)

#  define XPCOM_SEARCH_KEY "PATH"
#  define GRE_CONF_NAME "gre.config"
#  define GRE_WIN_REG_LOC L"Software\\mozilla.org\\GRE"
#  define XPCOM_DLL XUL_DLL
#  define LXPCOM_DLL LXUL_DLL
#  define XUL_DLL "xul.dll"
#  define LXUL_DLL L"xul.dll"

#else                  // Unix
#  include <limits.h>  // for PATH_MAX

#  define XPCOM_DLL XUL_DLL

// you have to love apple..
#  ifdef XP_MACOSX
#    define XPCOM_SEARCH_KEY "DYLD_LIBRARY_PATH"
#    define GRE_FRAMEWORK_NAME "XUL.framework"
#    define XUL_DLL "XUL"
#  else
#    define XPCOM_SEARCH_KEY "LD_LIBRARY_PATH"
#    define XUL_DLL "libxul" MOZ_DLL_SUFFIX
#  endif

#  define GRE_CONF_NAME ".gre.config"
#  define GRE_CONF_PATH "/etc/gre.conf"
#  define GRE_CONF_DIR "/etc/gre.d"
#  define GRE_USER_CONF_DIR ".gre.d"
#endif

#if defined(XP_WIN)
#  define XPCOM_FILE_PATH_SEPARATOR "\\"
#  define XPCOM_ENV_PATH_SEPARATOR ";"
#elif defined(XP_UNIX)
#  define XPCOM_FILE_PATH_SEPARATOR "/"
#  define XPCOM_ENV_PATH_SEPARATOR ":"
#else
#  error need_to_define_your_file_path_separator_and_illegal_characters
#endif

#ifdef AIX
#  include <sys/param.h>
#endif

#ifndef MAXPATHLEN
#  ifdef PATH_MAX
#    define MAXPATHLEN PATH_MAX
#  elif defined(_MAX_PATH)
#    define MAXPATHLEN _MAX_PATH
#  elif defined(CCHMAXPATH)
#    define MAXPATHLEN CCHMAXPATH
#  else
#    define MAXPATHLEN 1024
#  endif
#endif

// Needed by the IPC layer from off the main thread
extern char16_t* gGREBinPath;

namespace mozilla {
namespace services {

/**
 * Clears service cache, sets gXPCOMShuttingDown
 */
void Shutdown();

}  // namespace services
}  // namespace mozilla

#endif