| 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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 write_blocked_lists_[ClampPriority(priority)].push_back(stream_id); | 80 write_blocked_lists_[ClampPriority(priority)].push_back(stream_id); |
| 81 } | 81 } |
| 82 | 82 |
| 83 bool RemoveStreamFromWriteBlockedList(IdType stream_id, | 83 bool RemoveStreamFromWriteBlockedList(IdType stream_id, |
| 84 SpdyPriority priority) { | 84 SpdyPriority priority) { |
| 85 // We shouldn't really add a stream_id to a list multiple times, | 85 // We shouldn't really add a stream_id to a list multiple times, |
| 86 // but under some conditions it does happen. Doing a check in PushBack | 86 // but under some conditions it does happen. Doing a check in PushBack |
| 87 // would be too costly, so instead we check here to eliminate duplicates. | 87 // would be too costly, so instead we check here to eliminate duplicates. |
| 88 bool found = false; | 88 bool found = false; |
| 89 iterator it = std::find(write_blocked_lists_[priority].begin(), | 89 iterator it = std::find(write_blocked_lists_[priority].begin(), |
| 90 write_blocked_lists_[priority].end(), | 90 write_blocked_lists_[priority].end(), stream_id); |
| 91 stream_id); | |
| 92 while (it != write_blocked_lists_[priority].end()) { | 91 while (it != write_blocked_lists_[priority].end()) { |
| 93 found = true; | 92 found = true; |
| 94 iterator next_it = write_blocked_lists_[priority].erase(it); | 93 iterator next_it = write_blocked_lists_[priority].erase(it); |
| 95 it = std::find(next_it, write_blocked_lists_[priority].end(), stream_id); | 94 it = std::find(next_it, write_blocked_lists_[priority].end(), stream_id); |
| 96 } | 95 } |
| 97 return found; | 96 return found; |
| 98 } | 97 } |
| 99 | 98 |
| 100 void UpdateStreamPriorityInWriteBlockedList(IdType stream_id, | 99 void UpdateStreamPriorityInWriteBlockedList(IdType stream_id, |
| 101 SpdyPriority old_priority, | 100 SpdyPriority old_priority, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 118 } | 117 } |
| 119 | 118 |
| 120 private: | 119 private: |
| 121 friend WriteBlockedListPeer; | 120 friend WriteBlockedListPeer; |
| 122 BlockedList write_blocked_lists_[kLowestPriority + 1]; | 121 BlockedList write_blocked_lists_[kLowestPriority + 1]; |
| 123 }; | 122 }; |
| 124 | 123 |
| 125 } // namespace net | 124 } // namespace net |
| 126 | 125 |
| 127 #endif // NET_SPDY_WRITE_BLOCKED_LIST_H_ | 126 #endif // NET_SPDY_WRITE_BLOCKED_LIST_H_ |
| OLD | NEW |