Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* This Source Code Form is subject to the terms of the Mozilla Public
3 : * License, v. 2.0. If a copy of the MPL was not distributed with this
4 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 :
6 : #include "mozilla/Bootstrap.h"
7 : #include "nsXPCOM.h"
8 :
9 : namespace mozilla {
10 :
11 : class BootstrapImpl final : public Bootstrap
12 : {
13 : protected:
14 0 : virtual void Dispose() override
15 : {
16 0 : delete this;
17 0 : }
18 :
19 : public:
20 3 : BootstrapImpl()
21 3 : {
22 3 : }
23 :
24 0 : ~BootstrapImpl()
25 0 : {
26 0 : }
27 :
28 3 : virtual void NS_LogInit() override {
29 3 : ::NS_LogInit();
30 3 : }
31 :
32 0 : virtual void NS_LogTerm() override {
33 0 : ::NS_LogTerm();
34 0 : }
35 :
36 0 : virtual void XRE_TelemetryAccumulate(int aID, uint32_t aSample) override {
37 0 : ::XRE_TelemetryAccumulate(aID, aSample);
38 0 : }
39 :
40 1 : virtual void XRE_StartupTimelineRecord(int aEvent, mozilla::TimeStamp aWhen) override {
41 1 : ::XRE_StartupTimelineRecord(aEvent, aWhen);
42 1 : }
43 :
44 1 : virtual int XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig) override {
45 1 : return ::XRE_main(argc, argv, aConfig);
46 : }
47 :
48 0 : virtual void XRE_StopLateWriteChecks() override {
49 0 : ::XRE_StopLateWriteChecks();
50 0 : }
51 :
52 0 : virtual int XRE_XPCShellMain(int argc, char** argv, char** envp, const XREShellData* aShellData) override {
53 0 : return ::XRE_XPCShellMain(argc, argv, envp, aShellData);
54 : }
55 :
56 0 : virtual GeckoProcessType XRE_GetProcessType() override {
57 0 : return ::XRE_GetProcessType();
58 : }
59 :
60 2 : virtual void XRE_SetProcessType(const char* aProcessTypeString) override {
61 2 : ::XRE_SetProcessType(aProcessTypeString);
62 2 : }
63 :
64 2 : virtual nsresult XRE_InitChildProcess(int argc, char* argv[], const XREChildData* aChildData) override {
65 2 : return ::XRE_InitChildProcess(argc, argv, aChildData);
66 : }
67 :
68 1 : virtual void XRE_EnableSameExecutableForContentProc() override {
69 1 : ::XRE_EnableSameExecutableForContentProc();
70 1 : }
71 :
72 : #ifdef MOZ_WIDGET_ANDROID
73 : virtual void GeckoStart(JNIEnv* aEnv, char** argv, int argc, const StaticXREAppData& aAppData) override {
74 : ::GeckoStart(aEnv, argv, argc, aAppData);
75 : }
76 :
77 : virtual void XRE_SetAndroidChildFds(JNIEnv* aEnv, int aCrashFd, int aIPCFd) override {
78 : ::XRE_SetAndroidChildFds(aEnv, aCrashFd, aIPCFd);
79 : }
80 : #endif
81 :
82 : #ifdef LIBFUZZER
83 : virtual void XRE_LibFuzzerSetDriver(LibFuzzerDriver aDriver) override {
84 : ::XRE_LibFuzzerSetDriver(aDriver);
85 : }
86 : #endif
87 :
88 : #ifdef MOZ_IPDL_TESTS
89 : virtual int XRE_RunIPDLTest(int argc, char **argv) override {
90 : return ::XRE_RunIPDLTest(argc, argv);
91 : }
92 : #endif
93 : };
94 :
95 : extern "C" NS_EXPORT void NS_FROZENCALL
96 3 : XRE_GetBootstrap(Bootstrap::UniquePtr& b)
97 : {
98 : static bool sBootstrapInitialized = false;
99 3 : MOZ_RELEASE_ASSERT(!sBootstrapInitialized);
100 :
101 3 : sBootstrapInitialized = true;
102 3 : b.reset(new BootstrapImpl());
103 3 : }
104 :
105 : } // namespace mozilla
|