2016-12-15 10:46:18 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#include "mozilla/Bootstrap.h"
|
|
|
|
#include "nsXPCOM.h"
|
|
|
|
|
2017-09-29 14:25:06 +03:00
|
|
|
#include "AutoSQLiteLifetime.h"
|
|
|
|
|
2019-03-19 02:52:31 +03:00
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
# ifdef MOZ_PROFILE_GENERATE
|
|
|
|
extern "C" int __llvm_profile_dump(void);
|
|
|
|
# endif
|
|
|
|
#endif
|
|
|
|
|
2016-12-15 10:46:18 +03:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class BootstrapImpl final : public Bootstrap {
|
|
|
|
protected:
|
2017-09-29 14:25:06 +03:00
|
|
|
AutoSQLiteLifetime mSQLLT;
|
|
|
|
|
2016-12-15 10:46:18 +03:00
|
|
|
virtual void Dispose() override { delete this; }
|
|
|
|
|
|
|
|
public:
|
2020-03-10 11:48:24 +03:00
|
|
|
BootstrapImpl() = default;
|
2016-12-15 10:46:18 +03:00
|
|
|
|
2020-03-10 11:48:24 +03:00
|
|
|
~BootstrapImpl() = default;
|
2016-12-15 10:46:18 +03:00
|
|
|
|
|
|
|
virtual void NS_LogInit() override { ::NS_LogInit(); }
|
|
|
|
|
|
|
|
virtual void NS_LogTerm() override { ::NS_LogTerm(); }
|
|
|
|
|
|
|
|
virtual void XRE_TelemetryAccumulate(int aID, uint32_t aSample) override {
|
|
|
|
::XRE_TelemetryAccumulate(aID, aSample);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void XRE_StartupTimelineRecord(int aEvent,
|
|
|
|
mozilla::TimeStamp aWhen) override {
|
|
|
|
::XRE_StartupTimelineRecord(aEvent, aWhen);
|
|
|
|
}
|
|
|
|
|
2017-01-10 10:43:23 +03:00
|
|
|
virtual int XRE_main(int argc, char* argv[],
|
|
|
|
const BootstrapConfig& aConfig) override {
|
|
|
|
return ::XRE_main(argc, argv, aConfig);
|
2016-12-15 10:46:18 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
virtual void XRE_StopLateWriteChecks() override {
|
|
|
|
::XRE_StopLateWriteChecks();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual int XRE_XPCShellMain(int argc, char** argv, char** envp,
|
|
|
|
const XREShellData* aShellData) override {
|
|
|
|
return ::XRE_XPCShellMain(argc, argv, envp, aShellData);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual GeckoProcessType XRE_GetProcessType() override {
|
|
|
|
return ::XRE_GetProcessType();
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void XRE_SetProcessType(const char* aProcessTypeString) override {
|
|
|
|
::XRE_SetProcessType(aProcessTypeString);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual nsresult XRE_InitChildProcess(
|
|
|
|
int argc, char* argv[], const XREChildData* aChildData) override {
|
|
|
|
return ::XRE_InitChildProcess(argc, argv, aChildData);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual void XRE_EnableSameExecutableForContentProc() override {
|
|
|
|
::XRE_EnableSameExecutableForContentProc();
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef MOZ_WIDGET_ANDROID
|
|
|
|
virtual void GeckoStart(JNIEnv* aEnv, char** argv, int argc,
|
2021-03-25 00:49:38 +03:00
|
|
|
const StaticXREAppData& aAppData,
|
|
|
|
bool xpcshell, const char* outFilePath) override {
|
|
|
|
::GeckoStart(aEnv, argv, argc, aAppData, xpcshell, outFilePath);
|
2016-12-15 10:46:18 +03:00
|
|
|
}
|
|
|
|
|
2018-07-03 01:01:25 +03:00
|
|
|
virtual void XRE_SetAndroidChildFds(
|
|
|
|
JNIEnv* aEnv, const XRE_AndroidChildFds& aFds) override {
|
|
|
|
::XRE_SetAndroidChildFds(aEnv, aFds);
|
2016-12-15 10:46:18 +03:00
|
|
|
}
|
2019-03-19 02:52:31 +03:00
|
|
|
|
|
|
|
# ifdef MOZ_PROFILE_GENERATE
|
|
|
|
virtual void XRE_WriteLLVMProfData() override {
|
|
|
|
__android_log_print(ANDROID_LOG_INFO, "GeckoLibLoad",
|
|
|
|
"Calling __llvm_profile_dump()");
|
|
|
|
__llvm_profile_dump();
|
|
|
|
}
|
|
|
|
# endif
|
2016-12-15 10:46:18 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef LIBFUZZER
|
2017-01-12 08:44:18 +03:00
|
|
|
virtual void XRE_LibFuzzerSetDriver(LibFuzzerDriver aDriver) override {
|
|
|
|
::XRE_LibFuzzerSetDriver(aDriver);
|
2016-12-15 10:46:18 +03:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef MOZ_IPDL_TESTS
|
|
|
|
virtual int XRE_RunIPDLTest(int argc, char** argv) override {
|
|
|
|
return ::XRE_RunIPDLTest(argc, argv);
|
|
|
|
}
|
|
|
|
#endif
|
2019-12-05 03:02:40 +03:00
|
|
|
|
|
|
|
#ifdef MOZ_ENABLE_FORKSERVER
|
|
|
|
virtual int XRE_ForkServer(int* argc, char*** argv) override {
|
|
|
|
return ::XRE_ForkServer(argc, argv);
|
|
|
|
}
|
|
|
|
#endif
|
2016-12-15 10:46:18 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
extern "C" NS_EXPORT void NS_FROZENCALL
|
|
|
|
XRE_GetBootstrap(Bootstrap::UniquePtr& b) {
|
|
|
|
static bool sBootstrapInitialized = false;
|
|
|
|
MOZ_RELEASE_ASSERT(!sBootstrapInitialized);
|
|
|
|
|
|
|
|
sBootstrapInitialized = true;
|
|
|
|
b.reset(new BootstrapImpl());
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mozilla
|