Bug 1526591 - Remove devtools.inspector.shapesHighlighter.enabled pref. r=rcaliman
[gecko.git] / netwerk / base / RedirectChannelRegistrar.h
blob7391fe8522df9c4c9f1f830b1c1f0eac5fa7f765
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 RedirectChannelRegistrar_h__
6 #define RedirectChannelRegistrar_h__
8 #include "nsIRedirectChannelRegistrar.h"
10 #include "nsIChannel.h"
11 #include "nsIParentChannel.h"
12 #include "nsInterfaceHashtable.h"
13 #include "mozilla/Attributes.h"
14 #include "mozilla/Mutex.h"
16 namespace mozilla {
17 namespace net {
19 class RedirectChannelRegistrar final : public nsIRedirectChannelRegistrar {
20 NS_DECL_ISUPPORTS
21 NS_DECL_NSIREDIRECTCHANNELREGISTRAR
23 RedirectChannelRegistrar();
25 private:
26 ~RedirectChannelRegistrar() = default;
28 public:
29 // Singleton accessor
30 static already_AddRefed<nsIRedirectChannelRegistrar> GetOrCreate();
32 // Cleanup the singleton instance on shutdown
33 static void Shutdown();
35 protected:
36 typedef nsInterfaceHashtable<nsUint32HashKey, nsIChannel> ChannelHashtable;
37 typedef nsInterfaceHashtable<nsUint32HashKey, nsIParentChannel>
38 ParentChannelHashtable;
40 ChannelHashtable mRealChannels;
41 ParentChannelHashtable mParentChannels;
42 uint32_t mId;
43 Mutex mLock;
45 static StaticRefPtr<RedirectChannelRegistrar> gSingleton;
48 } // namespace net
49 } // namespace mozilla
51 #endif