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_WRITE_BLOCKED_LIST_H_ | 5 #ifndef NET_QUIC_QUIC_WRITE_BLOCKED_LIST_H_ |
6 #define NET_QUIC_QUIC_WRITE_BLOCKED_LIST_H_ | 6 #define NET_QUIC_QUIC_WRITE_BLOCKED_LIST_H_ |
7 | 7 |
| 8 #include <stddef.h> |
| 9 #include <stdint.h> |
| 10 |
8 #include <set> | 11 #include <set> |
9 | 12 |
| 13 #include "base/macros.h" |
10 #include "net/base/net_export.h" | 14 #include "net/base/net_export.h" |
11 #include "net/quic/quic_flags.h" | 15 #include "net/quic/quic_flags.h" |
12 #include "net/quic/quic_protocol.h" | 16 #include "net/quic/quic_protocol.h" |
13 #include "net/spdy/priority_write_scheduler.h" | 17 #include "net/spdy/priority_write_scheduler.h" |
14 #include "net/spdy/write_blocked_list.h" | 18 #include "net/spdy/write_blocked_list.h" |
15 | 19 |
16 namespace net { | 20 namespace net { |
17 | 21 |
18 // Keeps tracks of the QUIC streams that have data to write, sorted by | 22 // Keeps tracks of the QUIC streams that have data to write, sorted by |
19 // priority. QUIC stream priority order is: | 23 // priority. QUIC stream priority order is: |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (use_new_blocked_list_) { | 117 if (use_new_blocked_list_) { |
114 priority_write_scheduler_.UpdateStreamPriority(stream_id, new_priority); | 118 priority_write_scheduler_.UpdateStreamPriority(stream_id, new_priority); |
115 } | 119 } |
116 } | 120 } |
117 | 121 |
118 void UpdateBytesForStream(QuicStreamId stream_id, size_t bytes) { | 122 void UpdateBytesForStream(QuicStreamId stream_id, size_t bytes) { |
119 if (batch_write_stream_id_[last_priority_popped_] == stream_id) { | 123 if (batch_write_stream_id_[last_priority_popped_] == stream_id) { |
120 // If this was the last data stream popped by PopFront, update the | 124 // If this was the last data stream popped by PopFront, update the |
121 // bytes remaining in its batch write. | 125 // bytes remaining in its batch write. |
122 bytes_left_for_batch_write_[last_priority_popped_] -= | 126 bytes_left_for_batch_write_[last_priority_popped_] -= |
123 static_cast<int32>(bytes); | 127 static_cast<int32_t>(bytes); |
124 } else { | 128 } else { |
125 // If a batch write stream was set, it should only be preempted by the | 129 // If a batch write stream was set, it should only be preempted by the |
126 // crypto or headers streams. Any higher priority data stream would | 130 // crypto or headers streams. Any higher priority data stream would |
127 // *become* the new batch write stream. | 131 // *become* the new batch write stream. |
128 if (FLAGS_quic_respect_send_alarm2 && FLAGS_quic_batch_writes) { | 132 if (FLAGS_quic_respect_send_alarm2 && FLAGS_quic_batch_writes) { |
129 DCHECK(stream_id == kCryptoStreamId || stream_id == kHeadersStreamId || | 133 DCHECK(stream_id == kCryptoStreamId || stream_id == kHeadersStreamId || |
130 batch_write_stream_id_[last_priority_popped_] == 0 || | 134 batch_write_stream_id_[last_priority_popped_] == 0 || |
131 bytes == 0); | 135 bytes == 0); |
132 } | 136 } |
133 } | 137 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 bool use_new_blocked_list_ = FLAGS_quic_new_blocked_list; | 182 bool use_new_blocked_list_ = FLAGS_quic_new_blocked_list; |
179 | 183 |
180 // If performing batch writes, this will be the stream ID of the stream doing | 184 // If performing batch writes, this will be the stream ID of the stream doing |
181 // batch writes for this priority level. We will allow this stream to write | 185 // batch writes for this priority level. We will allow this stream to write |
182 // until it has written kBatchWriteSize bytes, it has no more data to write, | 186 // until it has written kBatchWriteSize bytes, it has no more data to write, |
183 // or a higher priority stream preempts. | 187 // or a higher priority stream preempts. |
184 QuicStreamId batch_write_stream_id_[kV3LowestPriority + 1]; | 188 QuicStreamId batch_write_stream_id_[kV3LowestPriority + 1]; |
185 // Set to kBatchWriteSize when we set a new batch_write_stream_id_ for a given | 189 // Set to kBatchWriteSize when we set a new batch_write_stream_id_ for a given |
186 // priority. This is decremented with each write the stream does until it is | 190 // priority. This is decremented with each write the stream does until it is |
187 // done with its batch write. | 191 // done with its batch write. |
188 int32 bytes_left_for_batch_write_[kV3LowestPriority + 1]; | 192 int32_t bytes_left_for_batch_write_[kV3LowestPriority + 1]; |
189 // Tracks the last priority popped for UpdateBytesForStream. | 193 // Tracks the last priority popped for UpdateBytesForStream. |
190 SpdyPriority last_priority_popped_; | 194 SpdyPriority last_priority_popped_; |
191 | 195 |
192 bool crypto_stream_blocked_; | 196 bool crypto_stream_blocked_; |
193 bool headers_stream_blocked_; | 197 bool headers_stream_blocked_; |
194 | 198 |
195 DISALLOW_COPY_AND_ASSIGN(QuicWriteBlockedList); | 199 DISALLOW_COPY_AND_ASSIGN(QuicWriteBlockedList); |
196 }; | 200 }; |
197 | 201 |
198 } // namespace net | 202 } // namespace net |
199 | 203 |
200 #endif // NET_QUIC_QUIC_WRITE_BLOCKED_LIST_H_ | 204 #endif // NET_QUIC_QUIC_WRITE_BLOCKED_LIST_H_ |
OLD | NEW |