Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(310)

Side by Side Diff: net/quic/test_tools/quic_session_peer.cc

Issue 2651673004: Add quic_map_util. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/test_tools/quic_framer_peer.cc ('k') | net/tools/quic/quic_epoll_connection_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
8 #include "net/quic/core/quic_session.h" 7 #include "net/quic/core/quic_session.h"
9 #include "net/quic/core/quic_stream.h" 8 #include "net/quic/core/quic_stream.h"
9 #include "net/quic/platform/api/quic_map_util.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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 // static 84 // static
85 bool QuicSessionPeer::IsStreamClosed(QuicSession* session, QuicStreamId id) { 85 bool QuicSessionPeer::IsStreamClosed(QuicSession* session, QuicStreamId id) {
86 DCHECK_NE(0u, id); 86 DCHECK_NE(0u, id);
87 return session->IsClosedStream(id); 87 return session->IsClosedStream(id);
88 } 88 }
89 89
90 // static 90 // static
91 bool QuicSessionPeer::IsStreamCreated(QuicSession* session, QuicStreamId id) { 91 bool QuicSessionPeer::IsStreamCreated(QuicSession* session, QuicStreamId id) {
92 DCHECK_NE(0u, id); 92 DCHECK_NE(0u, id);
93 return base::ContainsKey(session->dynamic_streams(), id); 93 return QuicContainsKey(session->dynamic_streams(), id);
94 } 94 }
95 95
96 // static 96 // static
97 bool QuicSessionPeer::IsStreamAvailable(QuicSession* session, QuicStreamId id) { 97 bool QuicSessionPeer::IsStreamAvailable(QuicSession* session, QuicStreamId id) {
98 DCHECK_NE(0u, id); 98 DCHECK_NE(0u, id);
99 return base::ContainsKey(session->available_streams_, id); 99 return QuicContainsKey(session->available_streams_, id);
100 } 100 }
101 101
102 // static 102 // static
103 bool QuicSessionPeer::IsStreamUncreated(QuicSession* session, QuicStreamId id) { 103 bool QuicSessionPeer::IsStreamUncreated(QuicSession* session, QuicStreamId id) {
104 DCHECK_NE(0u, id); 104 DCHECK_NE(0u, id);
105 if (id % 2 == session->next_outgoing_stream_id_ % 2) { 105 if (id % 2 == session->next_outgoing_stream_id_ % 2) {
106 // locally-created stream. 106 // locally-created stream.
107 return id >= session->next_outgoing_stream_id_; 107 return id >= session->next_outgoing_stream_id_;
108 } else { 108 } else {
109 // peer-created stream. 109 // peer-created stream.
110 return id > session->largest_peer_created_stream_id_; 110 return id > session->largest_peer_created_stream_id_;
111 } 111 }
112 } 112 }
113 113
114 } // namespace test 114 } // namespace test
115 } // namespace net 115 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/test_tools/quic_framer_peer.cc ('k') | net/tools/quic/quic_epoll_connection_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698