OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 5 #ifndef NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
6 #define NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 6 #define NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // called after connecting if the helper is not available before. | 43 // called after connecting if the helper is not available before. |
44 // |on_can_write| will be triggered when fake-unblocking; ownership will be | 44 // |on_can_write| will be triggered when fake-unblocking; ownership will be |
45 // assumed. | 45 // assumed. |
46 void Initialize(QuicConnectionHelperInterface* helper, | 46 void Initialize(QuicConnectionHelperInterface* helper, |
47 Delegate* on_can_write); | 47 Delegate* on_can_write); |
48 | 48 |
49 // QuicPacketWriter methods: | 49 // QuicPacketWriter methods: |
50 WriteResult WritePacket(const char* buffer, | 50 WriteResult WritePacket(const char* buffer, |
51 size_t buf_len, | 51 size_t buf_len, |
52 const IPAddressNumber& self_address, | 52 const IPAddressNumber& self_address, |
53 const IPEndPoint& peer_address) override; | 53 const IPEndPoint& peer_address, |
| 54 PerPacketOptions* options) override; |
54 | 55 |
55 bool IsWriteBlocked() const override; | 56 bool IsWriteBlocked() const override; |
56 | 57 |
57 void SetWritable() override; | 58 void SetWritable() override; |
58 | 59 |
59 // Writes out any packet which should have been sent by now | 60 // Writes out any packet which should have been sent by now |
60 // to the contained writer and returns the time | 61 // to the contained writer and returns the time |
61 // for the next delayed packet to be written. | 62 // for the next delayed packet to be written. |
62 QuicTime ReleaseOldPackets(); | 63 QuicTime ReleaseOldPackets(); |
63 | 64 |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 // for the next delayed packet to be written. | 121 // for the next delayed packet to be written. |
121 QuicTime ReleaseNextPacket(); | 122 QuicTime ReleaseNextPacket(); |
122 | 123 |
123 // A single packet which will be sent at the supplied send_time. | 124 // A single packet which will be sent at the supplied send_time. |
124 struct DelayedWrite { | 125 struct DelayedWrite { |
125 public: | 126 public: |
126 DelayedWrite(const char* buffer, | 127 DelayedWrite(const char* buffer, |
127 size_t buf_len, | 128 size_t buf_len, |
128 const IPAddressNumber& self_address, | 129 const IPAddressNumber& self_address, |
129 const IPEndPoint& peer_address, | 130 const IPEndPoint& peer_address, |
| 131 std::unique_ptr<PerPacketOptions> options, |
130 QuicTime send_time); | 132 QuicTime send_time); |
| 133 // TODO(rtenneti): on windows RValue reference gives errors. |
| 134 DelayedWrite(DelayedWrite&& other); |
| 135 // TODO(rtenneti): on windows RValue reference gives errors. |
| 136 // DelayedWrite& operator=(DelayedWrite&& other); |
131 ~DelayedWrite(); | 137 ~DelayedWrite(); |
132 | 138 |
133 std::string buffer; | 139 std::string buffer; |
134 const IPAddressNumber self_address; | 140 const IPAddressNumber self_address; |
135 const IPEndPoint peer_address; | 141 const IPEndPoint peer_address; |
| 142 std::unique_ptr<PerPacketOptions> options; |
136 QuicTime send_time; | 143 QuicTime send_time; |
| 144 |
| 145 private: |
| 146 DISALLOW_COPY_AND_ASSIGN(DelayedWrite); |
137 }; | 147 }; |
138 | 148 |
139 typedef std::list<DelayedWrite> DelayedPacketList; | 149 typedef std::list<DelayedWrite> DelayedPacketList; |
140 | 150 |
141 const QuicClock* clock_; | 151 const QuicClock* clock_; |
142 scoped_ptr<QuicAlarm> write_unblocked_alarm_; | 152 scoped_ptr<QuicAlarm> write_unblocked_alarm_; |
143 scoped_ptr<QuicAlarm> delay_alarm_; | 153 scoped_ptr<QuicAlarm> delay_alarm_; |
144 scoped_ptr<Delegate> on_can_write_; | 154 scoped_ptr<Delegate> on_can_write_; |
145 net::test::SimpleRandom simple_random_; | 155 net::test::SimpleRandom simple_random_; |
146 // Stored packets delayed by fake packet delay or bandwidth restrictions. | 156 // Stored packets delayed by fake packet delay or bandwidth restrictions. |
(...skipping 10 matching lines...) Expand all Loading... |
157 QuicBandwidth fake_bandwidth_; | 167 QuicBandwidth fake_bandwidth_; |
158 QuicByteCount buffer_size_; | 168 QuicByteCount buffer_size_; |
159 | 169 |
160 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); | 170 DISALLOW_COPY_AND_ASSIGN(PacketDroppingTestWriter); |
161 }; | 171 }; |
162 | 172 |
163 } // namespace test | 173 } // namespace test |
164 } // namespace net | 174 } // namespace net |
165 | 175 |
166 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ | 176 #endif // NET_TOOLS_QUIC_TEST_TOOLS_PACKET_DROPPING_TEST_WRITER_H_ |
OLD | NEW |