Bug 1931425 - Limit how often moz-label's #setStyles runs r=reusable-components-revie...
[gecko.git] / netwerk / system / android / nsAndroidNetworkLinkService.h
blobeaa3e2de4a3a1175cdb0b9428b29608d05156994
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef NSANDROIDNETWORKLINKSERVICE_H_
8 #define NSANDROIDNETWORKLINKSERVICE_H_
10 #include "nsINetworkLinkService.h"
11 #include "nsIObserver.h"
12 #include "../netlink/NetlinkService.h"
14 class nsAndroidNetworkLinkService
15 : public nsINetworkLinkService,
16 public nsIObserver,
17 public mozilla::net::NetlinkServiceListener {
18 public:
19 NS_DECL_THREADSAFE_ISUPPORTS
20 NS_DECL_NSINETWORKLINKSERVICE
21 NS_DECL_NSIOBSERVER
23 nsAndroidNetworkLinkService();
25 nsresult Init();
27 void OnNetworkChanged() override;
28 void OnNetworkIDChanged() override;
29 void OnLinkUp() override;
30 void OnLinkDown() override;
31 void OnLinkStatusKnown() override;
32 void OnDnsSuffixListUpdated() override;
34 private:
35 virtual ~nsAndroidNetworkLinkService() = default;
37 // Called when xpcom-shutdown-threads is received.
38 nsresult Shutdown();
40 // Sends the network event.
41 void NotifyObservers(const char* aTopic, const char* aData);
43 mozilla::Atomic<bool, mozilla::Relaxed> mStatusIsKnown;
45 RefPtr<mozilla::net::NetlinkService> mNetlinkSvc;
48 #endif /* NSANDROIDNETWORKLINKSERVICE_H_ */