OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_BASE_NETWORK_THROTTLE_MANAGER_IMPL_H_ | 5 #ifndef NET_BASE_NETWORK_THROTTLE_MANAGER_IMPL_H_ |
6 #define NET_BASE_NETWORK_THROTTLE_MANAGER_IMPL_H_ | 6 #define NET_BASE_NETWORK_THROTTLE_MANAGER_IMPL_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 // base::Timer controlling outstanding request recomputation. | 123 // base::Timer controlling outstanding request recomputation. |
124 // | 124 // |
125 // This is started whenever it is not running and a new throttle is | 125 // This is started whenever it is not running and a new throttle is |
126 // added to |outstanding_throttles_|, and is never cleared except by | 126 // added to |outstanding_throttles_|, and is never cleared except by |
127 // execution, which re-starts it if there are any | 127 // execution, which re-starts it if there are any |
128 // outstanding_throttles_. So it should always be running if any | 128 // outstanding_throttles_. So it should always be running if any |
129 // throttles are outstanding. This guarantees that the class will | 129 // throttles are outstanding. This guarantees that the class will |
130 // eventually detect aging out of outstanding throttles and unblock | 130 // eventually detect aging out of outstanding throttles and unblock |
131 // throttles blocked on those outstanding throttles. | 131 // throttles blocked on those outstanding throttles. |
132 base::Timer outstanding_recomputation_timer_; | 132 base::OneShotTimer outstanding_recomputation_timer_; |
133 | 133 |
134 // FIFO of OUTSTANDING throttles (ordered by time of entry into the | 134 // FIFO of OUTSTANDING throttles (ordered by time of entry into the |
135 // OUTSTANDING state). | 135 // OUTSTANDING state). |
136 ThrottleList outstanding_throttles_; | 136 ThrottleList outstanding_throttles_; |
137 | 137 |
138 // FIFO list of BLOCKED throttles. This is a list so that the | 138 // FIFO list of BLOCKED throttles. This is a list so that the |
139 // throttles can store iterators to themselves. | 139 // throttles can store iterators to themselves. |
140 ThrottleList blocked_throttles_; | 140 ThrottleList blocked_throttles_; |
141 | 141 |
142 // For testing. | 142 // For testing. |
143 std::unique_ptr<base::TickClock> tick_clock_; | 143 std::unique_ptr<base::TickClock> tick_clock_; |
144 | 144 |
145 base::WeakPtrFactory<NetworkThrottleManagerImpl> weak_ptr_factory_; | 145 base::WeakPtrFactory<NetworkThrottleManagerImpl> weak_ptr_factory_; |
146 | 146 |
147 DISALLOW_COPY_AND_ASSIGN(NetworkThrottleManagerImpl); | 147 DISALLOW_COPY_AND_ASSIGN(NetworkThrottleManagerImpl); |
148 }; | 148 }; |
149 | 149 |
150 } // namespace net | 150 } // namespace net |
151 | 151 |
152 #endif // NET_BASE_NETWORK_THROTTLE_MANAGER_IMPL_H_ | 152 #endif // NET_BASE_NETWORK_THROTTLE_MANAGER_IMPL_H_ |
OLD | NEW |