OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_QUIC_QUIC_CLIENT_SESSION_BASE_H_ | 5 #ifndef NET_QUIC_QUIC_CLIENT_SESSION_BASE_H_ |
6 #define NET_QUIC_QUIC_CLIENT_SESSION_BASE_H_ | 6 #define NET_QUIC_QUIC_CLIENT_SESSION_BASE_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "net/quic/quic_client_promised_info.h" | 9 #include "net/quic/quic_client_promised_info.h" |
10 #include "net/quic/quic_crypto_client_stream.h" | 10 #include "net/quic/quic_crypto_client_stream.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 // promised. | 81 // promised. |
82 void DeletePromised(QuicClientPromisedInfo* promised); | 82 void DeletePromised(QuicClientPromisedInfo* promised); |
83 | 83 |
84 // Sends Rst for the stream, and makes sure that future calls to | 84 // Sends Rst for the stream, and makes sure that future calls to |
85 // IsClosedStream(id) return true, which ensures that any subsequent | 85 // IsClosedStream(id) return true, which ensures that any subsequent |
86 // frames related to this stream will be ignored (modulo flow | 86 // frames related to this stream will be ignored (modulo flow |
87 // control accounting). | 87 // control accounting). |
88 void ResetPromised(QuicStreamId id, QuicRstStreamErrorCode error_code); | 88 void ResetPromised(QuicStreamId id, QuicRstStreamErrorCode error_code); |
89 | 89 |
90 size_t get_max_promises() const { | 90 size_t get_max_promises() const { |
91 return get_max_open_streams() * kMaxPromisedStreamsMultiplier; | 91 return max_open_incoming_streams() * kMaxPromisedStreamsMultiplier; |
92 } | 92 } |
93 | 93 |
94 private: | 94 private: |
95 // For QuicSpdyClientStream to detect that a response corresponds to a | 95 // For QuicSpdyClientStream to detect that a response corresponds to a |
96 // promise. | 96 // promise. |
97 using QuicPromisedByIdMap = | 97 using QuicPromisedByIdMap = |
98 std::unordered_map<QuicStreamId, std::unique_ptr<QuicClientPromisedInfo>>; | 98 std::unordered_map<QuicStreamId, std::unique_ptr<QuicClientPromisedInfo>>; |
99 | 99 |
100 // As per rfc7540, section 10.5: track promise streams in "reserved | 100 // As per rfc7540, section 10.5: track promise streams in "reserved |
101 // (remote)". The primary key is URL from he promise request | 101 // (remote)". The primary key is URL from he promise request |
102 // headers. The promised stream id is a secondary key used to get | 102 // headers. The promised stream id is a secondary key used to get |
103 // promise info when the response headers of the promised stream | 103 // promise info when the response headers of the promised stream |
104 // arrive. | 104 // arrive. |
105 QuicPromisedByUrlMap* promised_by_url_; | 105 QuicPromisedByUrlMap* promised_by_url_; |
106 QuicPromisedByIdMap promised_by_id_; | 106 QuicPromisedByIdMap promised_by_id_; |
107 QuicStreamId largest_promised_stream_id_; | 107 QuicStreamId largest_promised_stream_id_; |
108 | 108 |
109 DISALLOW_COPY_AND_ASSIGN(QuicClientSessionBase); | 109 DISALLOW_COPY_AND_ASSIGN(QuicClientSessionBase); |
110 }; | 110 }; |
111 | 111 |
112 } // namespace net | 112 } // namespace net |
113 | 113 |
114 #endif // NET_QUIC_QUIC_CLIENT_SESSION_BASE_H_ | 114 #endif // NET_QUIC_QUIC_CLIENT_SESSION_BASE_H_ |
OLD | NEW |