tor-browser

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

InputChannelThrottleQueueParent.h (1440B)


      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 InputChannelThrottleQueueParent_h__
      7 #define InputChannelThrottleQueueParent_h__
      8 
      9 #include "nsISupportsImpl.h"
     10 #include "nsIThrottledInputChannel.h"
     11 #include "mozilla/net/PInputChannelThrottleQueueParent.h"
     12 
     13 namespace mozilla {
     14 namespace net {
     15 
     16 #define INPUT_CHANNEL_THROTTLE_QUEUE_PARENT_IID \
     17  {0x4f151655, 0x70b3, 0x4350, {0x9b, 0xd9, 0xe3, 0x2b, 0xe5, 0xeb, 0xb2, 0x9e}}
     18 
     19 class InputChannelThrottleQueueParent final
     20    : public PInputChannelThrottleQueueParent,
     21      public nsIInputChannelThrottleQueue {
     22 public:
     23  NS_DECL_ISUPPORTS
     24  NS_DECL_NSIINPUTCHANNELTHROTTLEQUEUE
     25  NS_INLINE_DECL_STATIC_IID(INPUT_CHANNEL_THROTTLE_QUEUE_PARENT_IID)
     26 
     27  friend class PInputChannelThrottleQueueParent;
     28 
     29  explicit InputChannelThrottleQueueParent() = default;
     30  mozilla::ipc::IPCResult RecvRecordRead(const uint32_t& aBytesRead);
     31  void ActorDestroy(ActorDestroyReason aWhy) override {}
     32 
     33 private:
     34  virtual ~InputChannelThrottleQueueParent() = default;
     35 
     36  uint64_t mBytesProcessed{0};
     37  uint32_t mMeanBytesPerSecond{0};
     38  uint32_t mMaxBytesPerSecond{0};
     39 };
     40 
     41 }  // namespace net
     42 }  // namespace mozilla
     43 
     44 #endif  // InputChannelThrottleQueueParent_h__