diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-13 15:05:36 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2019-02-14 10:33:47 +0000 |
commit | e684a3455bcc29a6e3e66a004e352dea4e1141e7 (patch) | |
tree | d55b4003bde34d7d05f558f02cfd82b2a66a7aac /chromium/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_stream_impl.h | |
parent | 2b94bfe47ccb6c08047959d1c26e392919550e86 (diff) | |
download | qtwebengine-chromium-e684a3455bcc29a6e3e66a004e352dea4e1141e7.tar.gz |
BASELINE: Update Chromium to 72.0.3626.110 and Ninja to 1.9.0
Change-Id: Ic57220b00ecc929a893c91f5cc552f5d3e99e922
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_stream_impl.h')
-rw-r--r-- | chromium/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_stream_impl.h | 77 |
1 files changed, 59 insertions, 18 deletions
diff --git a/chromium/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_stream_impl.h b/chromium/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_stream_impl.h index 81cb68d02d0..f4553acd8f5 100644 --- a/chromium/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_stream_impl.h +++ b/chromium/third_party/blink/renderer/modules/peerconnection/adapters/p2p_quic_stream_impl.h @@ -14,10 +14,28 @@ namespace blink { class MODULES_EXPORT P2PQuicStreamImpl final : public P2PQuicStream, public quic::QuicStream { public: - P2PQuicStreamImpl(quic::QuicStreamId id, quic::QuicSession* session); + P2PQuicStreamImpl(quic::QuicStreamId id, + quic::QuicSession* session, + uint32_t delegate_read_buffer_size, + uint32_t write_buffer_size); ~P2PQuicStreamImpl() override; + // P2PQuicStream overrides + void SetDelegate(P2PQuicStream::Delegate* delegate) override; + + void Reset() override; + + void WriteData(Vector<uint8_t> data, bool fin) override; + + void MarkReceivedDataConsumed(uint32_t amount) override; - // QuicStream overrides. + // For testing purposes. This is returns true after quic::QuicStream::OnClose + bool IsClosedForTesting(); + + // For testing purposes. This exposes the amount of received data that the + // P2PQuicStream is aware is buffered by the delegate. + uint32_t DelegateReadBufferedAmountForTesting(); + + // quic::QuicStream overrides. // // Right now this marks the data as consumed and drops it. // TODO(https://crbug.com/874296): We need to update this function for @@ -25,31 +43,54 @@ class MODULES_EXPORT P2PQuicStreamImpl final : public P2PQuicStream, // busy. See: // https://w3c.github.io/webrtc-quic/#dom-rtcquicstream-waitforreadable void OnDataAvailable() override; - - // P2PQuicStream overrides - void SetDelegate(P2PQuicStream::Delegate* delegate) override; - - void Reset() override; - - void Finish() override; - - // quic::QuicStream overrides - // // Called by the quic::QuicSession when receiving a RST_STREAM frame from the // remote side. This closes the stream for reading & writing (if not already // closed), and sends a RST_STREAM frame if one has not been sent yet. void OnStreamReset(const quic::QuicRstStreamFrame& frame) override; + // Called by the quic::QuicSession. This means the stream is closed for + // reading + // and writing, and can now be deleted by the quic::QuicSession. + void OnClose() override; - // Called when the stream has finished consumed data up to the FIN bit from - // the quic::QuicStreamSequencer. This will close the underlying QuicStream - // for reading. This can be called either by the P2PQuicStreamImpl when - // reading data, or by the quic::QuicStreamSequencer if we're done reading & - // receive a stream frame with the FIN bit. - void OnFinRead() override; + protected: + // quic::QuicStream overrides. + // + // Called when written data (from WriteData()) is consumed by QUIC. This means + // the data has either been sent across the wire, or it has been turned into a + // packet and queued if the socket is unexpectedly blocked. + void OnStreamDataConsumed(size_t bytes_consumed) override; private: using quic::QuicStream::Reset; + + // Outlives the P2PQuicStreamImpl. Delegate* delegate_; + + // The read buffer size of the delegate. The |delegate_read_buffered_amount_| + // must never exceed this value (enforced by the P2PQuicStreamImpl). + const uint32_t delegate_read_buffer_size_; + // The maximum size allowed to be buffered write side. The + // |write_buffered_amount_| must never exceed this value, and it is up + // to the delegate to enforce this. + const uint32_t write_buffer_size_; + // How much total data has been received and given to the delegate, + // but not yet consumed by the delegate. This value gets increased when data + // is received from the QUIC library in OnDataAvailable() and and decreased + // when the delegate updates that data has been read with + // MarkReceivedDataConsumed(). + uint32_t delegate_read_buffered_amount_ = 0; + // How much data is buffered by the QUIC library, but has not yet + // been sent. This value gets increased when WriteData() is called + // and decreased when OnDataConsumed() gets called by the QUIC library, + // due to the data being sent. + uint32_t write_buffered_amount_ = 0; + + // Set after OnClose gets called. + bool closed_ = false; + + // This is set after the sequencer is closed due to the P2PQuicStream + // consuming all of the sequencer's data up to the FIN bit. + bool consumed_fin_ = false; }; } // namespace blink |