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/quic_connection_peer.h" | 5 #include "net/quic/test_tools/quic_connection_peer.h" |
6 | 6 |
7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
8 #include "net/quic/congestion_control/receive_algorithm_interface.h" | 8 #include "net/quic/congestion_control/receive_algorithm_interface.h" |
9 #include "net/quic/congestion_control/send_algorithm_interface.h" | 9 #include "net/quic/congestion_control/send_algorithm_interface.h" |
10 #include "net/quic/quic_connection.h" | 10 #include "net/quic/quic_connection.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 return connection->timeout_alarm_.get(); | 201 return connection->timeout_alarm_.get(); |
202 } | 202 } |
203 | 203 |
204 // static | 204 // static |
205 QuicPacketWriter* QuicConnectionPeer::GetWriter(QuicConnection* connection) { | 205 QuicPacketWriter* QuicConnectionPeer::GetWriter(QuicConnection* connection) { |
206 return connection->writer_; | 206 return connection->writer_; |
207 } | 207 } |
208 | 208 |
209 // static | 209 // static |
210 void QuicConnectionPeer::SetWriter(QuicConnection* connection, | 210 void QuicConnectionPeer::SetWriter(QuicConnection* connection, |
211 QuicPacketWriter* writer) { | 211 QuicPacketWriter* writer, |
| 212 bool owns_writer) { |
| 213 if (connection->owns_writer_) { |
| 214 delete connection->writer_; |
| 215 } |
212 connection->writer_ = writer; | 216 connection->writer_ = writer; |
| 217 connection->owns_writer_ = owns_writer; |
213 } | 218 } |
214 | 219 |
215 // static | 220 // static |
216 void QuicConnectionPeer::CloseConnection(QuicConnection* connection) { | 221 void QuicConnectionPeer::CloseConnection(QuicConnection* connection) { |
217 connection->connected_ = false; | 222 connection->connected_ = false; |
218 } | 223 } |
219 | 224 |
220 // static | 225 // static |
221 QuicEncryptedPacket* QuicConnectionPeer::GetConnectionClosePacket( | 226 QuicEncryptedPacket* QuicConnectionPeer::GetConnectionClosePacket( |
222 QuicConnection* connection) { | 227 QuicConnection* connection) { |
223 return connection->connection_close_packet_.get(); | 228 return connection->connection_close_packet_.get(); |
224 } | 229 } |
225 | 230 |
226 // static | 231 // static |
227 void QuicConnectionPeer::SetSupportedVersions(QuicConnection* connection, | 232 void QuicConnectionPeer::SetSupportedVersions(QuicConnection* connection, |
228 QuicVersionVector versions) { | 233 QuicVersionVector versions) { |
229 connection->framer_.SetSupportedVersions(versions); | 234 connection->framer_.SetSupportedVersions(versions); |
230 } | 235 } |
231 | 236 |
232 } // namespace test | 237 } // namespace test |
233 } // namespace net | 238 } // namespace net |
OLD | NEW |