/src/mozilla-central/toolkit/xre/Bootstrap.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | #include "AutoSQLiteLifetime.h" |
10 | | |
11 | | namespace mozilla { |
12 | | |
13 | | class BootstrapImpl final : public Bootstrap |
14 | | { |
15 | | protected: |
16 | | AutoSQLiteLifetime mSQLLT; |
17 | | |
18 | | virtual void Dispose() override |
19 | 0 | { |
20 | 0 | delete this; |
21 | 0 | } |
22 | | |
23 | | public: |
24 | | BootstrapImpl() |
25 | 3 | { |
26 | 3 | } |
27 | | |
28 | | ~BootstrapImpl() |
29 | 0 | { |
30 | 0 | } |
31 | | |
32 | 3 | virtual void NS_LogInit() override { |
33 | 3 | ::NS_LogInit(); |
34 | 3 | } |
35 | | |
36 | 0 | virtual void NS_LogTerm() override { |
37 | 0 | ::NS_LogTerm(); |
38 | 0 | } |
39 | | |
40 | 0 | virtual void XRE_TelemetryAccumulate(int aID, uint32_t aSample) override { |
41 | 0 | ::XRE_TelemetryAccumulate(aID, aSample); |
42 | 0 | } |
43 | | |
44 | 3 | virtual void XRE_StartupTimelineRecord(int aEvent, mozilla::TimeStamp aWhen) override { |
45 | 3 | ::XRE_StartupTimelineRecord(aEvent, aWhen); |
46 | 3 | } |
47 | | |
48 | 3 | virtual int XRE_main(int argc, char* argv[], const BootstrapConfig& aConfig) override { |
49 | 3 | return ::XRE_main(argc, argv, aConfig); |
50 | 3 | } |
51 | | |
52 | 0 | virtual void XRE_StopLateWriteChecks() override { |
53 | 0 | ::XRE_StopLateWriteChecks(); |
54 | 0 | } |
55 | | |
56 | 0 | virtual int XRE_XPCShellMain(int argc, char** argv, char** envp, const XREShellData* aShellData) override { |
57 | 0 | return ::XRE_XPCShellMain(argc, argv, envp, aShellData); |
58 | 0 | } |
59 | | |
60 | 0 | virtual GeckoProcessType XRE_GetProcessType() override { |
61 | 0 | return ::XRE_GetProcessType(); |
62 | 0 | } |
63 | | |
64 | 0 | virtual void XRE_SetProcessType(const char* aProcessTypeString) override { |
65 | 0 | ::XRE_SetProcessType(aProcessTypeString); |
66 | 0 | } |
67 | | |
68 | 0 | virtual nsresult XRE_InitChildProcess(int argc, char* argv[], const XREChildData* aChildData) override { |
69 | 0 | return ::XRE_InitChildProcess(argc, argv, aChildData); |
70 | 0 | } |
71 | | |
72 | 3 | virtual void XRE_EnableSameExecutableForContentProc() override { |
73 | 3 | ::XRE_EnableSameExecutableForContentProc(); |
74 | 3 | } |
75 | | |
76 | | #ifdef MOZ_WIDGET_ANDROID |
77 | | virtual void GeckoStart(JNIEnv* aEnv, char** argv, int argc, const StaticXREAppData& aAppData) override { |
78 | | ::GeckoStart(aEnv, argv, argc, aAppData); |
79 | | } |
80 | | |
81 | | virtual void XRE_SetAndroidChildFds(JNIEnv* aEnv, const XRE_AndroidChildFds& aFds) override { |
82 | | ::XRE_SetAndroidChildFds(aEnv, aFds); |
83 | | } |
84 | | #endif |
85 | | |
86 | | #ifdef LIBFUZZER |
87 | 3 | virtual void XRE_LibFuzzerSetDriver(LibFuzzerDriver aDriver) override { |
88 | 3 | ::XRE_LibFuzzerSetDriver(aDriver); |
89 | 3 | } |
90 | | #endif |
91 | | |
92 | | #ifdef MOZ_IPDL_TESTS |
93 | | virtual int XRE_RunIPDLTest(int argc, char **argv) override { |
94 | | return ::XRE_RunIPDLTest(argc, argv); |
95 | | } |
96 | | #endif |
97 | | }; |
98 | | |
99 | | extern "C" NS_EXPORT void NS_FROZENCALL |
100 | | XRE_GetBootstrap(Bootstrap::UniquePtr& b) |
101 | 3 | { |
102 | 3 | static bool sBootstrapInitialized = false; |
103 | 3 | MOZ_RELEASE_ASSERT(!sBootstrapInitialized); |
104 | 3 | |
105 | 3 | sBootstrapInitialized = true; |
106 | 3 | b.reset(new BootstrapImpl()); |
107 | 3 | } |
108 | | |
109 | | } // namespace mozilla |