| 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_session_peer.h" | 5 #include "net/quic/test_tools/quic_session_peer.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "net/quic/quic_session.h" | 8 #include "net/quic/quic_session.h" |
| 9 #include "net/quic/reliable_quic_stream.h" | 9 #include "net/quic/reliable_quic_stream.h" |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 uint32 max_streams) { | 23 uint32 max_streams) { |
| 24 session->max_open_streams_ = max_streams; | 24 session->max_open_streams_ = max_streams; |
| 25 } | 25 } |
| 26 | 26 |
| 27 // static | 27 // static |
| 28 QuicCryptoStream* QuicSessionPeer::GetCryptoStream(QuicSession* session) { | 28 QuicCryptoStream* QuicSessionPeer::GetCryptoStream(QuicSession* session) { |
| 29 return session->GetCryptoStream(); | 29 return session->GetCryptoStream(); |
| 30 } | 30 } |
| 31 | 31 |
| 32 // static | 32 // static |
| 33 QuicHeadersStream* QuicSessionPeer::GetHeadersStream(QuicSession* session) { | |
| 34 return session->headers_stream_.get(); | |
| 35 } | |
| 36 | |
| 37 // static | |
| 38 void QuicSessionPeer::SetHeadersStream(QuicSession* session, | |
| 39 QuicHeadersStream* headers_stream) { | |
| 40 session->headers_stream_.reset(headers_stream); | |
| 41 } | |
| 42 | |
| 43 // static | |
| 44 QuicWriteBlockedList* QuicSessionPeer::GetWriteBlockedStreams( | 33 QuicWriteBlockedList* QuicSessionPeer::GetWriteBlockedStreams( |
| 45 QuicSession* session) { | 34 QuicSession* session) { |
| 46 return &session->write_blocked_streams_; | 35 return &session->write_blocked_streams_; |
| 47 } | 36 } |
| 48 | 37 |
| 49 // static | 38 // static |
| 50 QuicDataStream* QuicSessionPeer::GetIncomingDataStream( | 39 ReliableQuicStream* QuicSessionPeer::GetIncomingDynamicStream( |
| 51 QuicSession* session, | 40 QuicSession* session, |
| 52 QuicStreamId stream_id) { | 41 QuicStreamId stream_id) { |
| 53 return session->GetIncomingDataStream(stream_id); | 42 return session->GetIncomingDynamicStream(stream_id); |
| 54 } | 43 } |
| 55 | 44 |
| 56 // static | 45 // static |
| 57 map<QuicStreamId, QuicStreamOffset>& | 46 map<QuicStreamId, QuicStreamOffset>& |
| 58 QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(QuicSession* session) { | 47 QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(QuicSession* session) { |
| 59 return session->locally_closed_streams_highest_offset_; | 48 return session->locally_closed_streams_highest_offset_; |
| 60 } | 49 } |
| 61 | 50 |
| 62 // static | 51 // static |
| 63 bool QuicSessionPeer::IsStreamClosed(QuicSession* session, QuicStreamId id) { | 52 bool QuicSessionPeer::IsStreamClosed(QuicSession* session, QuicStreamId id) { |
| 64 DCHECK_NE(0u, id); | 53 DCHECK_NE(0u, id); |
| 65 return session->IsClosedStream(id); | 54 return session->IsClosedStream(id); |
| 66 } | 55 } |
| 67 | 56 |
| 68 // static | 57 // static |
| 69 bool QuicSessionPeer::IsStreamCreated(QuicSession* session, QuicStreamId id) { | 58 bool QuicSessionPeer::IsStreamCreated(QuicSession* session, QuicStreamId id) { |
| 70 DCHECK_NE(0u, id); | 59 DCHECK_NE(0u, id); |
| 71 return ContainsKey(session->stream_map_, id); | 60 return ContainsKey(session->dynamic_streams(), id); |
| 72 } | 61 } |
| 73 | 62 |
| 74 // static | 63 // static |
| 75 bool QuicSessionPeer::IsStreamImplicitlyCreated(QuicSession* session, | 64 bool QuicSessionPeer::IsStreamImplicitlyCreated(QuicSession* session, |
| 76 QuicStreamId id) { | 65 QuicStreamId id) { |
| 77 DCHECK_NE(0u, id); | 66 DCHECK_NE(0u, id); |
| 78 return ContainsKey(session->implicitly_created_streams_, id); | 67 return ContainsKey(session->implicitly_created_streams_, id); |
| 79 } | 68 } |
| 80 | 69 |
| 81 // static | 70 // static |
| 82 bool QuicSessionPeer::IsStreamUncreated(QuicSession* session, QuicStreamId id) { | 71 bool QuicSessionPeer::IsStreamUncreated(QuicSession* session, QuicStreamId id) { |
| 83 DCHECK_NE(0u, id); | 72 DCHECK_NE(0u, id); |
| 84 if (id % 2 == session->next_stream_id_ % 2) { | 73 if (id % 2 == session->next_stream_id_ % 2) { |
| 85 // locally-created stream. | 74 // locally-created stream. |
| 86 return id >= session->next_stream_id_; | 75 return id >= session->next_stream_id_; |
| 87 } else { | 76 } else { |
| 88 // peer-created stream. | 77 // peer-created stream. |
| 89 return id > session->largest_peer_created_stream_id_; | 78 return id > session->largest_peer_created_stream_id_; |
| 90 } | 79 } |
| 91 } | 80 } |
| 92 | 81 |
| 93 } // namespace test | 82 } // namespace test |
| 94 } // namespace net | 83 } // namespace net |
| OLD | NEW |