| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/test_tools/reliable_quic_stream_peer.h" | 5 #include "net/quic/test_tools/reliable_quic_stream_peer.h" |
| 6 | 6 |
| 7 #include <list> | 7 #include <list> |
| 8 | 8 |
| 9 #include "net/quic/reliable_quic_stream.h" | 9 #include "net/quic/reliable_quic_stream.h" |
| 10 | 10 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 // static | 32 // static |
| 33 bool ReliableQuicStreamPeer::FinSent(ReliableQuicStream* stream) { | 33 bool ReliableQuicStreamPeer::FinSent(ReliableQuicStream* stream) { |
| 34 return stream->fin_sent_; | 34 return stream->fin_sent_; |
| 35 } | 35 } |
| 36 | 36 |
| 37 // static | 37 // static |
| 38 bool ReliableQuicStreamPeer::RstSent(ReliableQuicStream* stream) { | 38 bool ReliableQuicStreamPeer::RstSent(ReliableQuicStream* stream) { |
| 39 return stream->rst_sent_; | 39 return stream->rst_sent_; |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static | |
| 43 void ReliableQuicStreamPeer::SetFlowControlSendOffset( | |
| 44 ReliableQuicStream* stream, | |
| 45 QuicStreamOffset offset) { | |
| 46 stream->flow_control_send_limit_ = offset; | |
| 47 } | |
| 48 | 42 |
| 49 // static | |
| 50 void ReliableQuicStreamPeer::SetFlowControlReceiveOffset( | |
| 51 ReliableQuicStream* stream, | |
| 52 QuicStreamOffset offset) { | |
| 53 stream->flow_control_receive_window_offset_bytes_ = offset; | |
| 54 } | |
| 55 | |
| 56 // static | |
| 57 void ReliableQuicStreamPeer::SetFlowControlMaxReceiveWindow( | |
| 58 ReliableQuicStream* stream, | |
| 59 uint64 window_size) { | |
| 60 stream->max_flow_control_receive_window_bytes_ = window_size; | |
| 61 } | |
| 62 | |
| 63 // static | |
| 64 QuicStreamOffset ReliableQuicStreamPeer::SendWindowOffset( | |
| 65 ReliableQuicStream* stream) { | |
| 66 return stream->flow_control_send_limit_; | |
| 67 } | |
| 68 | |
| 69 // static | |
| 70 QuicStreamOffset ReliableQuicStreamPeer::SendWindowSize( | |
| 71 ReliableQuicStream* stream) { | |
| 72 return stream->SendWindowSize(); | |
| 73 } | |
| 74 | |
| 75 // static | |
| 76 QuicStreamOffset ReliableQuicStreamPeer::ReceiveWindowOffset( | |
| 77 ReliableQuicStream* stream) { | |
| 78 return stream->flow_control_receive_window_offset_bytes_; | |
| 79 } | |
| 80 | |
| 81 // static | |
| 82 uint64 ReliableQuicStreamPeer::ReceiveWindowSize(ReliableQuicStream* stream) { | |
| 83 return stream->flow_control_receive_window_offset_bytes_ - | |
| 84 stream->TotalReceivedBytes(); | |
| 85 } | |
| 86 | 43 |
| 87 // static | 44 // static |
| 88 uint32 ReliableQuicStreamPeer::SizeOfQueuedData(ReliableQuicStream* stream) { | 45 uint32 ReliableQuicStreamPeer::SizeOfQueuedData(ReliableQuicStream* stream) { |
| 89 uint32 total = 0; | 46 uint32 total = 0; |
| 90 std::list<ReliableQuicStream::PendingData>::iterator it = | 47 std::list<ReliableQuicStream::PendingData>::iterator it = |
| 91 stream->queued_data_.begin(); | 48 stream->queued_data_.begin(); |
| 92 while (it != stream->queued_data_.end()) { | 49 while (it != stream->queued_data_.end()) { |
| 93 total += it->data.size(); | 50 total += it->data.size(); |
| 94 ++it; | 51 ++it; |
| 95 } | 52 } |
| 96 return total; | 53 return total; |
| 97 } | 54 } |
| 98 | 55 |
| 99 } // namespace test | 56 } // namespace test |
| 100 } // namespace net | 57 } // namespace net |
| OLD | NEW |