| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| 11 #include <deque> | 11 #include <deque> |
| 12 #include <unordered_map> |
| 12 | 13 |
| 13 #include "base/containers/hash_tables.h" | |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "net/spdy/spdy_protocol.h" | 15 #include "net/spdy/spdy_protocol.h" |
| 16 | 16 |
| 17 namespace net { | 17 namespace net { |
| 18 | 18 |
| 19 namespace test { | 19 namespace test { |
| 20 class WriteBlockedListPeer; | 20 class WriteBlockedListPeer; |
| 21 } // namespace test | 21 } // namespace test |
| 22 | 22 |
| 23 template <typename IdType> | 23 template <typename IdType> |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 size_t NumBlockedStreams(SpdyPriority priority) const { | 146 size_t NumBlockedStreams(SpdyPriority priority) const { |
| 147 priority = ClampPriority(priority); | 147 priority = ClampPriority(priority); |
| 148 return write_blocked_lists_[priority].size(); | 148 return write_blocked_lists_[priority].size(); |
| 149 } | 149 } |
| 150 | 150 |
| 151 private: | 151 private: |
| 152 friend class net::test::WriteBlockedListPeer; | 152 friend class net::test::WriteBlockedListPeer; |
| 153 | 153 |
| 154 typedef base::hash_map<IdType, SpdyPriority> StreamToPriorityMap; | 154 using StreamToPriorityMap = std::unordered_map<IdType, SpdyPriority>; |
| 155 | 155 |
| 156 void AddStream(IdType stream_id, SpdyPriority priority, bool push_back) { | 156 void AddStream(IdType stream_id, SpdyPriority priority, bool push_back) { |
| 157 priority = ClampPriority(priority); | 157 priority = ClampPriority(priority); |
| 158 DVLOG(2) << "Adding stream " << stream_id << " at priority " | 158 DVLOG(2) << "Adding stream " << stream_id << " at priority " |
| 159 << static_cast<int>(priority); | 159 << static_cast<int>(priority); |
| 160 bool should_insert_stream = true; | 160 bool should_insert_stream = true; |
| 161 typename StreamToPriorityMap::iterator iter = | 161 typename StreamToPriorityMap::iterator iter = |
| 162 stream_to_priority_.find(stream_id); | 162 stream_to_priority_.find(stream_id); |
| 163 // Ensure the stream is not in the write blocked list multiple times. | 163 // Ensure the stream is not in the write blocked list multiple times. |
| 164 if (iter != stream_to_priority_.end()) { | 164 if (iter != stream_to_priority_.end()) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 185 } | 185 } |
| 186 } | 186 } |
| 187 } | 187 } |
| 188 BlockedList write_blocked_lists_[kV3LowestPriority + 1]; | 188 BlockedList write_blocked_lists_[kV3LowestPriority + 1]; |
| 189 StreamToPriorityMap stream_to_priority_; | 189 StreamToPriorityMap stream_to_priority_; |
| 190 }; | 190 }; |
| 191 | 191 |
| 192 } // namespace net | 192 } // namespace net |
| 193 | 193 |
| 194 #endif // NET_SPDY_WRITE_BLOCKED_LIST_H_ | 194 #endif // NET_SPDY_WRITE_BLOCKED_LIST_H_ |
| OLD | NEW |