tor-browser

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

HttpConnectionMgrParent.h (1472B)


      1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
      2 /* This Source Code Form is subject to the terms of the Mozilla Public
      3 * License, v. 2.0. If a copy of the MPL was not distributed with this
      4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      5 
      6 #ifndef HttpConnectionMgrParent_h__
      7 #define HttpConnectionMgrParent_h__
      8 
      9 #include "HttpConnectionMgrShell.h"
     10 #include "mozilla/net/PHttpConnectionMgrParent.h"
     11 #include "mozilla/StaticMutex.h"
     12 
     13 namespace mozilla::net {
     14 
     15 // HttpConnectionMgrParent plays the role of nsHttpConnectionMgr and delegates
     16 // the work to the nsHttpConnectionMgr in socket process.
     17 class HttpConnectionMgrParent final : public PHttpConnectionMgrParent,
     18                                      public HttpConnectionMgrShell {
     19 public:
     20  NS_DECL_ISUPPORTS
     21  NS_DECL_HTTPCONNECTIONMGRSHELL
     22 
     23  explicit HttpConnectionMgrParent() = default;
     24 
     25  static uint32_t AddHttpUpgradeListenerToMap(
     26      nsIHttpUpgradeListener* aListener);
     27  static void RemoveHttpUpgradeListenerFromMap(uint32_t aId);
     28  static Maybe<nsCOMPtr<nsIHttpUpgradeListener>>
     29  GetAndRemoveHttpUpgradeListener(uint32_t aId);
     30 
     31 private:
     32  virtual ~HttpConnectionMgrParent() = default;
     33 
     34  bool mShutDown{false};
     35  static uint32_t sListenerId;
     36  static StaticMutex sLock MOZ_UNANNOTATED;
     37  static nsTHashMap<uint32_t, nsCOMPtr<nsIHttpUpgradeListener>>
     38      sHttpUpgradeListenerMap;
     39 };
     40 
     41 }  // namespace mozilla::net
     42 
     43 #endif  // HttpConnectionMgrParent_h__