Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; 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 : #ifndef nsAppStartup_h__
7 : #define nsAppStartup_h__
8 :
9 : #include "nsIAppStartup.h"
10 : #include "nsIWindowCreator2.h"
11 : #include "nsIObserver.h"
12 : #include "nsWeakReference.h"
13 :
14 : #include "nsINativeAppSupport.h"
15 : #include "nsIAppShell.h"
16 : #include "mozilla/Attributes.h"
17 :
18 : #if defined(XP_WIN)
19 : //XPerf-backed probes
20 : #include "mozilla/perfprobe.h"
21 : #include "nsAutoPtr.h"
22 : #endif //defined(XP_WIN)
23 :
24 :
25 : // {7DD4D320-C84B-4624-8D45-7BB9B2356977}
26 : #define NS_TOOLKIT_APPSTARTUP_CID \
27 : { 0x7dd4d320, 0xc84b, 0x4624, { 0x8d, 0x45, 0x7b, 0xb9, 0xb2, 0x35, 0x69, 0x77 } }
28 :
29 :
30 : class nsAppStartup final : public nsIAppStartup,
31 : public nsIWindowCreator2,
32 : public nsIObserver,
33 : public nsSupportsWeakReference
34 : {
35 : public:
36 : NS_DECL_THREADSAFE_ISUPPORTS
37 : NS_DECL_NSIAPPSTARTUP
38 : NS_DECL_NSIWINDOWCREATOR
39 : NS_DECL_NSIWINDOWCREATOR2
40 : NS_DECL_NSIOBSERVER
41 :
42 : nsAppStartup();
43 : nsresult Init();
44 :
45 : private:
46 0 : ~nsAppStartup() { }
47 :
48 : void CloseAllWindows();
49 :
50 : friend class nsAppExitEvent;
51 :
52 : nsCOMPtr<nsIAppShell> mAppShell;
53 :
54 : int32_t mConsiderQuitStopper; // if > 0, Quit(eConsiderQuit) fails
55 : bool mRunning; // Have we started the main event loop?
56 : bool mShuttingDown; // Quit method reentrancy check
57 : bool mStartingUp; // Have we passed final-ui-startup?
58 : bool mAttemptingQuit; // Quit(eAttemptQuit) still trying
59 : bool mRestart; // Quit(eRestart)
60 : bool mInterrupted; // Was startup interrupted by an interactive prompt?
61 : bool mIsSafeModeNecessary; // Whether safe mode is necessary
62 : bool mStartupCrashTrackingEnded; // Whether startup crash tracking has already ended
63 : bool mRestartNotSameProfile; // Quit(eRestartNotSameProfile)
64 :
65 : #if defined(XP_WIN)
66 : //Interaction with OS-provided profiling probes
67 : typedef mozilla::probes::ProbeManager ProbeManager;
68 : typedef mozilla::probes::Probe Probe;
69 : RefPtr<ProbeManager> mProbesManager;
70 : RefPtr<Probe> mPlacesInitCompleteProbe;
71 : RefPtr<Probe> mSessionWindowRestoredProbe;
72 : RefPtr<Probe> mXPCOMShutdownProbe;
73 : #endif
74 : };
75 :
76 : #endif // nsAppStartup_h__
|