LCOV - code coverage report
Current view: top level - source/common/quic - send_buffer_monitor.h (source / functions) Hit Total Coverage
Test: coverage.dat Lines: 2 2 100.0 %
Date: 2024-01-05 06:35:25 Functions: 2 2 100.0 %

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include "quiche/quic/core/quic_stream.h"
       4             : 
       5             : namespace Envoy {
       6             : namespace Quic {
       7             : 
       8             : // An interface for stream and connection to update send buffer watermark.
       9             : class SendBufferMonitor {
      10             : public:
      11         747 :   virtual ~SendBufferMonitor() = default;
      12             : 
      13             :   // A scoped object to update the send buffer size change of the given quic stream to
      14             :   // SendBufferMonitor during its life time. If the given send buffer monitor is already monitoring,
      15             :   // skip updating the monitor after it's out of scope because this updater is in the scope of
      16             :   // another one.
      17             :   class ScopedWatermarkBufferUpdater {
      18             :   public:
      19             :     ScopedWatermarkBufferUpdater(quic::QuicStream* quic_stream,
      20             :                                  SendBufferMonitor* send_buffer_monitor);
      21             : 
      22             :     ~ScopedWatermarkBufferUpdater();
      23             : 
      24             :   private:
      25             :     quic::QuicStream* quic_stream_{nullptr};
      26             :     uint64_t old_buffered_bytes_{0};
      27             :     SendBufferMonitor* send_buffer_monitor_{nullptr};
      28             :   };
      29             : 
      30             : protected:
      31             :   // Update the monitor with the new buffered bytes and check watermark threshold.
      32             :   virtual void updateBytesBuffered(uint64_t old_buffered_bytes, uint64_t new_buffered_bytes) = 0;
      33             : 
      34         232 :   bool isDoingWatermarkAccounting() const { return is_doing_watermark_accounting_; }
      35             : 
      36             : private:
      37             :   bool is_doing_watermark_accounting_{false};
      38             : };
      39             : 
      40             : } // namespace Quic
      41             : } // namespace Envoy

Generated by: LCOV version 1.15