| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/devtools/devtools_network_interceptor.h" | 5 #include "chrome/browser/devtools/devtools_network_interceptor.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/devtools/devtools_network_conditions.h" | 10 #include "chrome/browser/devtools/devtools_network_conditions.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 | 70 |
| 71 if (conditions_->offline()) { | 71 if (conditions_->offline()) { |
| 72 timer_.Stop(); | 72 timer_.Stop(); |
| 73 throttled_.clear(); | 73 throttled_.clear(); |
| 74 suspended_.clear(); | 74 suspended_.clear(); |
| 75 Throttables old_throttables(throttables_); | 75 Throttables old_throttables(throttables_); |
| 76 Throttables::iterator it = old_throttables.begin(); | 76 Throttables::iterator it = old_throttables.begin(); |
| 77 for (;it != old_throttables.end(); ++it) { | 77 for (;it != old_throttables.end(); ++it) { |
| 78 if (throttables_.find(*it) == throttables_.end()) | 78 if (throttables_.find(*it) == throttables_.end()) |
| 79 continue; | 79 continue; |
| 80 if (!(*it)->HasStarted() || (*it)->HasFailed()) | |
| 81 continue; | |
| 82 (*it)->Fail(); | 80 (*it)->Fail(); |
| 83 } | 81 } |
| 84 return; | 82 return; |
| 85 } | 83 } |
| 86 | 84 |
| 87 if (conditions_->IsThrottling()) { | 85 if (conditions_->IsThrottling()) { |
| 88 DCHECK(conditions_->download_throughput() != 0); | 86 DCHECK(conditions_->download_throughput() != 0); |
| 89 offset_ = now; | 87 offset_ = now; |
| 90 last_tick_ = 0; | 88 last_tick_ = 0; |
| 91 int64_t us_tick_length = | 89 int64_t us_tick_length = |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 236 ArmTimer(now); | 234 ArmTimer(now); |
| 237 } | 235 } |
| 238 | 236 |
| 239 bool DevToolsNetworkInterceptor::ShouldFail() { | 237 bool DevToolsNetworkInterceptor::ShouldFail() { |
| 240 return conditions_->offline(); | 238 return conditions_->offline(); |
| 241 } | 239 } |
| 242 | 240 |
| 243 bool DevToolsNetworkInterceptor::ShouldThrottle() { | 241 bool DevToolsNetworkInterceptor::ShouldThrottle() { |
| 244 return conditions_->IsThrottling(); | 242 return conditions_->IsThrottling(); |
| 245 } | 243 } |
| OLD | NEW |