1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef nsUserIdleServiceX_h_
6 #define nsUserIdleServiceX_h_
8 #include "nsUserIdleService.h"
9 #include "mozilla/AppShutdown.h"
11 class nsUserIdleServiceX
: public nsUserIdleService
{
13 NS_INLINE_DECL_REFCOUNTING_INHERITED(nsUserIdleServiceX
, nsUserIdleService
)
15 bool PollIdleTime(uint32_t* aIdleTime
) override
;
17 static already_AddRefed
<nsUserIdleServiceX
> GetInstance() {
18 RefPtr
<nsUserIdleService
> idleService
= nsUserIdleService::GetInstance();
20 // Avoid late instantiation or resurrection during shutdown.
21 if (mozilla::AppShutdown::IsInOrBeyond(
22 mozilla::ShutdownPhase::AppShutdownConfirmed
)) {
25 idleService
= new nsUserIdleServiceX();
28 return idleService
.forget().downcast
<nsUserIdleServiceX
>();
32 nsUserIdleServiceX() {}
33 virtual ~nsUserIdleServiceX() {}
36 #endif // nsUserIdleServiceX_h_