Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(478)

Side by Side Diff: net/base/network_throttle_manager_impl.h

Issue 2837863004: Use base::OneShotTimer instead of base::Timer(false, false)
Patch Set: rebase Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/test_helpers.cc ('k') | net/base/network_throttle_manager_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_
OLDNEW
« no previous file with comments | « media/base/test_helpers.cc ('k') | net/base/network_throttle_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698