| 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/core/quic_session.h" | 8 #include "net/quic/core/quic_session.h" |
| 9 #include "net/quic/core/reliable_quic_stream.h" | 9 #include "net/quic/core/quic_stream.h" |
| 10 | 10 |
| 11 namespace net { | 11 namespace net { |
| 12 namespace test { | 12 namespace test { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 QuicStreamId QuicSessionPeer::GetNextOutgoingStreamId(QuicSession* session) { | 15 QuicStreamId QuicSessionPeer::GetNextOutgoingStreamId(QuicSession* session) { |
| 16 return session->GetNextOutgoingStreamId(); | 16 return session->GetNextOutgoingStreamId(); |
| 17 } | 17 } |
| 18 | 18 |
| 19 // static | 19 // static |
| (...skipping 19 matching lines...) Expand all Loading... |
| 39 return session->GetCryptoStream(); | 39 return session->GetCryptoStream(); |
| 40 } | 40 } |
| 41 | 41 |
| 42 // static | 42 // static |
| 43 QuicWriteBlockedList* QuicSessionPeer::GetWriteBlockedStreams( | 43 QuicWriteBlockedList* QuicSessionPeer::GetWriteBlockedStreams( |
| 44 QuicSession* session) { | 44 QuicSession* session) { |
| 45 return &session->write_blocked_streams_; | 45 return &session->write_blocked_streams_; |
| 46 } | 46 } |
| 47 | 47 |
| 48 // static | 48 // static |
| 49 ReliableQuicStream* QuicSessionPeer::GetOrCreateDynamicStream( | 49 QuicStream* QuicSessionPeer::GetOrCreateDynamicStream(QuicSession* session, |
| 50 QuicSession* session, | 50 QuicStreamId stream_id) { |
| 51 QuicStreamId stream_id) { | |
| 52 return session->GetOrCreateDynamicStream(stream_id); | 51 return session->GetOrCreateDynamicStream(stream_id); |
| 53 } | 52 } |
| 54 | 53 |
| 55 // static | 54 // static |
| 56 std::map<QuicStreamId, QuicStreamOffset>& | 55 std::map<QuicStreamId, QuicStreamOffset>& |
| 57 QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(QuicSession* session) { | 56 QuicSessionPeer::GetLocallyClosedStreamsHighestOffset(QuicSession* session) { |
| 58 return session->locally_closed_streams_highest_offset_; | 57 return session->locally_closed_streams_highest_offset_; |
| 59 } | 58 } |
| 60 | 59 |
| 61 // static | 60 // static |
| 62 QuicSession::StaticStreamMap& QuicSessionPeer::static_streams( | 61 QuicSession::StaticStreamMap& QuicSessionPeer::static_streams( |
| 63 QuicSession* session) { | 62 QuicSession* session) { |
| 64 return session->static_streams(); | 63 return session->static_streams(); |
| 65 } | 64 } |
| 66 | 65 |
| 67 // static | 66 // static |
| 68 QuicSession::DynamicStreamMap& QuicSessionPeer::dynamic_streams( | 67 QuicSession::DynamicStreamMap& QuicSessionPeer::dynamic_streams( |
| 69 QuicSession* session) { | 68 QuicSession* session) { |
| 70 return session->dynamic_streams(); | 69 return session->dynamic_streams(); |
| 71 } | 70 } |
| 72 | 71 |
| 73 // static | 72 // static |
| 74 std::unordered_set<QuicStreamId>* QuicSessionPeer::GetDrainingStreams( | 73 std::unordered_set<QuicStreamId>* QuicSessionPeer::GetDrainingStreams( |
| 75 QuicSession* session) { | 74 QuicSession* session) { |
| 76 return &session->draining_streams_; | 75 return &session->draining_streams_; |
| 77 } | 76 } |
| 78 | 77 |
| 79 // static | 78 // static |
| 80 void QuicSessionPeer::ActivateStream( | 79 void QuicSessionPeer::ActivateStream(QuicSession* session, |
| 81 QuicSession* session, | 80 std::unique_ptr<QuicStream> stream) { |
| 82 std::unique_ptr<ReliableQuicStream> stream) { | |
| 83 return session->ActivateStream(std::move(stream)); | 81 return session->ActivateStream(std::move(stream)); |
| 84 } | 82 } |
| 85 | 83 |
| 86 // static | 84 // static |
| 87 bool QuicSessionPeer::IsStreamClosed(QuicSession* session, QuicStreamId id) { | 85 bool QuicSessionPeer::IsStreamClosed(QuicSession* session, QuicStreamId id) { |
| 88 DCHECK_NE(0u, id); | 86 DCHECK_NE(0u, id); |
| 89 return session->IsClosedStream(id); | 87 return session->IsClosedStream(id); |
| 90 } | 88 } |
| 91 | 89 |
| 92 // static | 90 // static |
| (...skipping 15 matching lines...) Expand all Loading... |
| 108 // locally-created stream. | 106 // locally-created stream. |
| 109 return id >= session->next_outgoing_stream_id_; | 107 return id >= session->next_outgoing_stream_id_; |
| 110 } else { | 108 } else { |
| 111 // peer-created stream. | 109 // peer-created stream. |
| 112 return id > session->largest_peer_created_stream_id_; | 110 return id > session->largest_peer_created_stream_id_; |
| 113 } | 111 } |
| 114 } | 112 } |
| 115 | 113 |
| 116 } // namespace test | 114 } // namespace test |
| 117 } // namespace net | 115 } // namespace net |
| OLD | NEW |