mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 11:55:49 +00:00
Bug 534701 - Make linkage work even in static builds (where nsEmbedFunctions.cpp is not built) r=cjones, a=bz for a CLOSED TREE
This commit is contained in:
parent
3865bbab5a
commit
28efe199cc
@ -3654,3 +3654,69 @@ XRE_main(int argc, char* argv[], const nsXREAppData* aAppData)
|
|||||||
|
|
||||||
return NS_FAILED(rv) ? 1 : 0;
|
return NS_FAILED(rv) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
XRE_InitCommandLine(int aArgc, char* aArgv[])
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
#if defined(MOZ_IPC)
|
||||||
|
|
||||||
|
#if defined(OS_WIN)
|
||||||
|
CommandLine::Init(aArgc, aArgv);
|
||||||
|
#else
|
||||||
|
// these leak on error, but that's OK: we'll just exit()
|
||||||
|
char** canonArgs = new char*[aArgc];
|
||||||
|
|
||||||
|
// get the canonical version of the binary's path
|
||||||
|
nsCOMPtr<nsILocalFile> binFile;
|
||||||
|
rv = XRE_GetBinaryPath(aArgv[0], getter_AddRefs(binFile));
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
nsCAutoString canonBinPath;
|
||||||
|
rv = binFile->GetNativePath(canonBinPath);
|
||||||
|
if (NS_FAILED(rv))
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
canonArgs[0] = strdup(canonBinPath.get());
|
||||||
|
|
||||||
|
for (int i = 1; i < aArgc; ++i) {
|
||||||
|
if (aArgv[i]) {
|
||||||
|
canonArgs[i] = strdup(aArgv[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NS_ASSERTION(!CommandLine::IsInitialized(), "Bad news!");
|
||||||
|
CommandLine::Init(aArgc, canonArgs);
|
||||||
|
|
||||||
|
for (int i = 0; i < aArgc; ++i)
|
||||||
|
free(canonArgs[i]);
|
||||||
|
delete[] canonArgs;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
XRE_DeinitCommandLine()
|
||||||
|
{
|
||||||
|
nsresult rv = NS_OK;
|
||||||
|
|
||||||
|
#if defined(MOZ_IPC)
|
||||||
|
CommandLine::Terminate();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
GeckoProcessType
|
||||||
|
XRE_GetProcessType()
|
||||||
|
{
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
return mozilla::startup::sChildProcessType;
|
||||||
|
#else
|
||||||
|
return GeckoProcessType_Default;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -182,4 +182,12 @@ void SetStrongPtr(T *&ptr, T* newvalue)
|
|||||||
NS_IF_ADDREF(ptr);
|
NS_IF_ADDREF(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef MOZ_IPC
|
||||||
|
namespace mozilla {
|
||||||
|
namespace startup {
|
||||||
|
extern GeckoProcessType sChildProcessType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // nsAppRunner_h__
|
#endif // nsAppRunner_h__
|
||||||
|
@ -97,6 +97,8 @@ using mozilla::plugins::PluginThreadChild;
|
|||||||
|
|
||||||
using mozilla::Monitor;
|
using mozilla::Monitor;
|
||||||
using mozilla::MonitorAutoEnter;
|
using mozilla::MonitorAutoEnter;
|
||||||
|
|
||||||
|
using mozilla::startup::sChildProcessType;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
static NS_DEFINE_CID(kAppShellCID, NS_APPSHELL_CID);
|
||||||
@ -232,7 +234,11 @@ XRE_StringToChildProcessType(const char* aProcessTypeString)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef MOZ_IPC
|
#ifdef MOZ_IPC
|
||||||
static GeckoProcessType sChildProcessType = GeckoProcessType_Default;
|
namespace mozilla {
|
||||||
|
namespace startup {
|
||||||
|
GeckoProcessType sChildProcessType = GeckoProcessType_Default;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static MessageLoop* sIOMessageLoop;
|
static MessageLoop* sIOMessageLoop;
|
||||||
|
|
||||||
@ -449,69 +455,3 @@ XRE_ShutdownChildProcess()
|
|||||||
|
|
||||||
#endif // MOZ_IPC
|
#endif // MOZ_IPC
|
||||||
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
XRE_InitCommandLine(int aArgc, char* aArgv[])
|
|
||||||
{
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
|
|
||||||
#if defined(MOZ_IPC)
|
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
|
||||||
CommandLine::Init(aArgc, aArgv);
|
|
||||||
#else
|
|
||||||
// these leak on error, but that's OK: we'll just exit()
|
|
||||||
char** canonArgs = new char*[aArgc];
|
|
||||||
|
|
||||||
// get the canonical version of the binary's path
|
|
||||||
nsCOMPtr<nsILocalFile> binFile;
|
|
||||||
rv = XRE_GetBinaryPath(aArgv[0], getter_AddRefs(binFile));
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
nsCAutoString canonBinPath;
|
|
||||||
rv = binFile->GetNativePath(canonBinPath);
|
|
||||||
if (NS_FAILED(rv))
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
canonArgs[0] = strdup(canonBinPath.get());
|
|
||||||
|
|
||||||
for (int i = 1; i < aArgc; ++i) {
|
|
||||||
if (aArgv[i]) {
|
|
||||||
canonArgs[i] = strdup(aArgv[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_ASSERTION(!CommandLine::IsInitialized(), "Bad news!");
|
|
||||||
CommandLine::Init(aArgc, canonArgs);
|
|
||||||
|
|
||||||
for (int i = 0; i < aArgc; ++i)
|
|
||||||
free(canonArgs[i]);
|
|
||||||
delete[] canonArgs;
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
nsresult
|
|
||||||
XRE_DeinitCommandLine()
|
|
||||||
{
|
|
||||||
nsresult rv = NS_OK;
|
|
||||||
|
|
||||||
#if defined(MOZ_IPC)
|
|
||||||
CommandLine::Terminate();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
GeckoProcessType
|
|
||||||
XRE_GetProcessType()
|
|
||||||
{
|
|
||||||
#ifdef MOZ_IPC
|
|
||||||
return sChildProcessType;
|
|
||||||
#else
|
|
||||||
return GeckoProcessType_Default;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user