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 #include "net/base/network_throttle_manager_impl.h" | 5 #include "net/base/network_throttle_manager_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
147 // This method should only be called once, and only if the | 147 // This method should only be called once, and only if the |
148 // current state is blocked. | 148 // current state is blocked. |
149 DCHECK_EQ(State::BLOCKED, state_); | 149 DCHECK_EQ(State::BLOCKED, state_); |
150 state_ = State::OUTSTANDING; | 150 state_ = State::OUTSTANDING; |
151 delegate_->OnThrottleUnblocked(this); | 151 delegate_->OnThrottleUnblocked(this); |
152 } | 152 } |
153 | 153 |
154 NetworkThrottleManagerImpl::NetworkThrottleManagerImpl() | 154 NetworkThrottleManagerImpl::NetworkThrottleManagerImpl() |
155 : lifetime_median_estimate_(PercentileEstimator::kMedianPercentile, | 155 : lifetime_median_estimate_(PercentileEstimator::kMedianPercentile, |
156 kInitialMedianInMs), | 156 kInitialMedianInMs), |
157 outstanding_recomputation_timer_(false /* retain_user_task */, | |
158 false /* is_repeating */), | |
159 tick_clock_(new base::DefaultTickClock()), | 157 tick_clock_(new base::DefaultTickClock()), |
160 weak_ptr_factory_(this) { | 158 weak_ptr_factory_(this) { |
161 outstanding_recomputation_timer_.SetTaskRunner( | 159 outstanding_recomputation_timer_.SetTaskRunner( |
162 base::ThreadTaskRunnerHandle::Get()); | 160 base::ThreadTaskRunnerHandle::Get()); |
163 } | 161 } |
164 | 162 |
165 NetworkThrottleManagerImpl::~NetworkThrottleManagerImpl() {} | 163 NetworkThrottleManagerImpl::~NetworkThrottleManagerImpl() {} |
166 | 164 |
167 std::unique_ptr<NetworkThrottleManager::Throttle> | 165 std::unique_ptr<NetworkThrottleManager::Throttle> |
168 NetworkThrottleManagerImpl::CreateThrottle( | 166 NetworkThrottleManagerImpl::CreateThrottle( |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 while (outstanding_throttles_.size() < kActiveRequestThrottlingLimit && | 315 while (outstanding_throttles_.size() < kActiveRequestThrottlingLimit && |
318 !blocked_throttles_.empty()) { | 316 !blocked_throttles_.empty()) { |
319 // NOTE: This call may result in reentrant calls into | 317 // NOTE: This call may result in reentrant calls into |
320 // NetworkThrottleManagerImpl; no state should be assumed to be | 318 // NetworkThrottleManagerImpl; no state should be assumed to be |
321 // persistent across this call. | 319 // persistent across this call. |
322 UnblockThrottle(blocked_throttles_.front()); | 320 UnblockThrottle(blocked_throttles_.front()); |
323 } | 321 } |
324 } | 322 } |
325 | 323 |
326 } // namespace net | 324 } // namespace net |
OLD | NEW |