tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

RedirectChannelRegistrar.h (1241B)


      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/. */
      4 
      5 #ifndef RedirectChannelRegistrar_h__
      6 #define RedirectChannelRegistrar_h__
      7 
      8 #include "nsIRedirectChannelRegistrar.h"
      9 
     10 #include "nsIChannel.h"
     11 #include "nsIParentChannel.h"
     12 #include "nsInterfaceHashtable.h"
     13 #include "mozilla/Attributes.h"
     14 #include "mozilla/Mutex.h"
     15 
     16 namespace mozilla {
     17 namespace net {
     18 
     19 class RedirectChannelRegistrar final : public nsIRedirectChannelRegistrar {
     20  NS_DECL_ISUPPORTS
     21  NS_DECL_NSIREDIRECTCHANNELREGISTRAR
     22 
     23  RedirectChannelRegistrar();
     24 
     25 private:
     26  ~RedirectChannelRegistrar() = default;
     27 
     28 public:
     29  // Singleton accessor
     30  static already_AddRefed<nsIRedirectChannelRegistrar> GetOrCreate();
     31 
     32 protected:
     33  using ChannelHashtable = nsInterfaceHashtable<nsUint64HashKey, nsIChannel>;
     34  using ParentChannelHashtable =
     35      nsInterfaceHashtable<nsUint64HashKey, nsIParentChannel>;
     36 
     37  ChannelHashtable mRealChannels;
     38  ParentChannelHashtable mParentChannels;
     39  Mutex mLock MOZ_UNANNOTATED;
     40 
     41  static StaticRefPtr<RedirectChannelRegistrar> gSingleton;
     42 };
     43 
     44 }  // namespace net
     45 }  // namespace mozilla
     46 
     47 #endif