LCOV - code coverage report
Current view: top level - netwerk/base - ThrottleQueue.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 1 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 1 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
       3             : /* This Source Code Form is subject to the terms of the Mozilla Public
       4             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       5             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       6             : 
       7             : #ifndef mozilla_net_ThrottleQueue_h
       8             : #define mozilla_net_ThrottleQueue_h
       9             : 
      10             : #include "mozilla/TimeStamp.h"
      11             : #include "nsIThrottledInputChannel.h"
      12             : #include "nsITimer.h"
      13             : 
      14             : namespace mozilla {
      15             : namespace net {
      16             : 
      17             : class ThrottleInputStream;
      18             : 
      19             : /**
      20             :  * An implementation of nsIInputChannelThrottleQueue that can be used
      21             :  * to throttle uploads.  This class is not thread-safe.
      22             :  * Initialization and calls to WrapStream may be done on any thread;
      23             :  * but otherwise, after creation, it can only be used on the socket
      24             :  * thread.  It currently throttles with a one second granularity, so
      25             :  * may be a bit choppy.
      26             :  */
      27             : 
      28             : class ThrottleQueue final
      29             :   : public nsIInputChannelThrottleQueue
      30             :   , public nsITimerCallback
      31             : {
      32             : public:
      33             : 
      34             :   ThrottleQueue();
      35             : 
      36             :   NS_DECL_THREADSAFE_ISUPPORTS
      37             :   NS_DECL_NSIINPUTCHANNELTHROTTLEQUEUE
      38             :   NS_DECL_NSITIMERCALLBACK
      39             : 
      40             :   void QueueStream(ThrottleInputStream* aStream);
      41             :   void DequeueStream(ThrottleInputStream* aStream);
      42             : 
      43             : private:
      44             : 
      45             :   ~ThrottleQueue();
      46             : 
      47           0 :   struct ThrottleEntry {
      48             :     TimeStamp mTime;
      49             :     uint32_t mBytesRead;
      50             :   };
      51             : 
      52             :   nsTArray<ThrottleEntry> mReadEvents;
      53             :   uint32_t mMeanBytesPerSecond;
      54             :   uint32_t mMaxBytesPerSecond;
      55             :   uint64_t mBytesProcessed;
      56             : 
      57             :   nsTArray<RefPtr<ThrottleInputStream>> mAsyncEvents;
      58             :   nsCOMPtr<nsITimer> mTimer;
      59             :   bool mTimerArmed;
      60             : };
      61             : 
      62             : }
      63             : }
      64             : 
      65             : #endif //  mozilla_net_ThrottleQueue_h

Generated by: LCOV version 1.13