tor-browser

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

nsHttpActivityDistributor.h (1171B)


      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 nsHttpActivityDistributor_h__
      6 #define nsHttpActivityDistributor_h__
      7 
      8 #include "nsIHttpActivityObserver.h"
      9 #include "nsTArray.h"
     10 #include "nsProxyRelease.h"
     11 #include "mozilla/Atomics.h"
     12 #include "mozilla/Mutex.h"
     13 
     14 namespace mozilla {
     15 namespace net {
     16 
     17 class nsHttpActivityDistributor : public nsIHttpActivityDistributor {
     18 public:
     19  using ObserverArray =
     20      nsTArray<nsMainThreadPtrHandle<nsIHttpActivityObserver>>;
     21  NS_DECL_THREADSAFE_ISUPPORTS
     22  NS_DECL_NSIHTTPACTIVITYOBSERVER
     23  NS_DECL_NSIHTTPACTIVITYDISTRIBUTOR
     24 
     25  nsHttpActivityDistributor() = default;
     26 
     27 protected:
     28  virtual ~nsHttpActivityDistributor() = default;
     29 
     30  ObserverArray mObservers;
     31  Mutex mLock MOZ_UNANNOTATED{"nsHttpActivityDistributor.mLock"};
     32  Atomic<bool, Relaxed> mActivated{false};
     33  Atomic<bool, Relaxed> mObserveProxyResponse{false};
     34  Atomic<bool, Relaxed> mObserveConnection{false};
     35 };
     36 
     37 }  // namespace net
     38 }  // namespace mozilla
     39 
     40 #endif  // nsHttpActivityDistributor_h__