| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_SPDY_WRITE_BLOCKED_LIST_H_ | 5 #ifndef NET_SPDY_WRITE_BLOCKED_LIST_H_ |
| 6 #define NET_SPDY_WRITE_BLOCKED_LIST_H_ | 6 #define NET_SPDY_WRITE_BLOCKED_LIST_H_ |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <deque> | 9 #include <deque> |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 if (priority > kLowestPriority) { | 38 if (priority > kLowestPriority) { |
| 39 LOG(DFATAL) << "Invalid priority: " << static_cast<int>(priority); | 39 LOG(DFATAL) << "Invalid priority: " << static_cast<int>(priority); |
| 40 return kLowestPriority; | 40 return kLowestPriority; |
| 41 } | 41 } |
| 42 return priority; | 42 return priority; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Returns the priority of the highest priority list with sessions on it. | 45 // Returns the priority of the highest priority list with sessions on it. |
| 46 SpdyPriority GetHighestPriorityWriteBlockedList() const { | 46 SpdyPriority GetHighestPriorityWriteBlockedList() const { |
| 47 for (SpdyPriority i = 0; i <= kLowestPriority; ++i) { | 47 for (SpdyPriority i = 0; i <= kLowestPriority; ++i) { |
| 48 if (write_blocked_lists_[i].size() > 0) | 48 if (write_blocked_lists_[i].size() > 0) { |
| 49 return i; | 49 return i; |
| 50 } |
| 50 } | 51 } |
| 51 LOG(DFATAL) << "No blocked streams"; | 52 LOG(DFATAL) << "No blocked streams"; |
| 52 return kHighestPriority; | 53 return kHighestPriority; |
| 53 } | 54 } |
| 54 | 55 |
| 55 IdType PopFront(SpdyPriority priority) { | 56 IdType PopFront(SpdyPriority priority) { |
| 56 priority = ClampPriority(priority); | 57 priority = ClampPriority(priority); |
| 57 DCHECK(!write_blocked_lists_[priority].empty()); | 58 DCHECK(!write_blocked_lists_[priority].empty()); |
| 58 IdType stream_id = write_blocked_lists_[priority].front(); | 59 IdType stream_id = write_blocked_lists_[priority].front(); |
| 59 write_blocked_lists_[priority].pop_front(); | 60 write_blocked_lists_[priority].pop_front(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 158 |
| 158 typedef base::hash_map<IdType, SpdyPriority> StreamToPriorityMap; | 159 typedef base::hash_map<IdType, SpdyPriority> StreamToPriorityMap; |
| 159 | 160 |
| 160 BlockedList write_blocked_lists_[kLowestPriority + 1]; | 161 BlockedList write_blocked_lists_[kLowestPriority + 1]; |
| 161 StreamToPriorityMap stream_to_priority_; | 162 StreamToPriorityMap stream_to_priority_; |
| 162 }; | 163 }; |
| 163 | 164 |
| 164 } // namespace net | 165 } // namespace net |
| 165 | 166 |
| 166 #endif // NET_SPDY_WRITE_BLOCKED_LIST_H_ | 167 #endif // NET_SPDY_WRITE_BLOCKED_LIST_H_ |
| OLD | NEW |