Bug 1877752 - Remove now-unused use_counter error metric. r=chutten
[gecko.git] / widget / android / nsUserIdleServiceAndroid.h
blob4e089b3db6035e716e21a5fa72f7c0e6c02c14dc
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=4:tabstop=4:
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef nsUserIdleServiceAndroid_h__
9 #define nsUserIdleServiceAndroid_h__
11 #include "nsUserIdleService.h"
12 #include "mozilla/AppShutdown.h"
14 class nsUserIdleServiceAndroid : public nsUserIdleService {
15 public:
16 NS_INLINE_DECL_REFCOUNTING_INHERITED(nsUserIdleServiceAndroid,
17 nsUserIdleService)
19 bool PollIdleTime(uint32_t* aIdleTime) override;
21 static already_AddRefed<nsUserIdleServiceAndroid> GetInstance() {
22 RefPtr<nsUserIdleService> idleService = nsUserIdleService::GetInstance();
23 if (!idleService) {
24 // Avoid late instantiation or resurrection during shutdown.
25 if (mozilla::AppShutdown::IsInOrBeyond(
26 mozilla::ShutdownPhase::AppShutdownConfirmed)) {
27 return nullptr;
29 idleService = new nsUserIdleServiceAndroid();
32 return idleService.forget().downcast<nsUserIdleServiceAndroid>();
35 protected:
36 nsUserIdleServiceAndroid() {}
37 virtual ~nsUserIdleServiceAndroid() {}
40 #endif // nsUserIdleServiceAndroid_h__