| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/common/net/url_fetcher_protect.h" | 5 #include "chrome/common/net/url_fetcher_protect.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 | 8 |
| 9 // URLFetcherProtectEntry ---------------------------------------------------- | 9 // URLFetcherProtectEntry ---------------------------------------------------- |
| 10 | 10 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 : sliding_window_period_(sliding_window_period), | 45 : sliding_window_period_(sliding_window_period), |
| 46 max_send_threshold_(max_send_threshold), | 46 max_send_threshold_(max_send_threshold), |
| 47 max_retries_(max_retries), | 47 max_retries_(max_retries), |
| 48 initial_timeout_(initial_timeout), | 48 initial_timeout_(initial_timeout), |
| 49 multiplier_(multiplier), | 49 multiplier_(multiplier), |
| 50 constant_factor_(constant_factor), | 50 constant_factor_(constant_factor), |
| 51 maximum_timeout_(maximum_timeout) { | 51 maximum_timeout_(maximum_timeout) { |
| 52 ResetBackoff(); | 52 ResetBackoff(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 URLFetcherProtectEntry::~URLFetcherProtectEntry() {} |
| 56 |
| 55 int64 URLFetcherProtectEntry::UpdateBackoff(EventType event_type) { | 57 int64 URLFetcherProtectEntry::UpdateBackoff(EventType event_type) { |
| 56 // request may be sent in different threads | 58 // request may be sent in different threads |
| 57 AutoLock lock(lock_); | 59 AutoLock lock(lock_); |
| 58 | 60 |
| 59 TimeDelta t; | 61 TimeDelta t; |
| 60 switch (event_type) { | 62 switch (event_type) { |
| 61 case SEND: | 63 case SEND: |
| 62 t = AntiOverload(); | 64 t = AntiOverload(); |
| 63 break; | 65 break; |
| 64 case SUCCESS: | 66 case SUCCESS: |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 169 |
| 168 ProtectService::iterator i = services_.find(id); | 170 ProtectService::iterator i = services_.find(id); |
| 169 if (i != services_.end()) { | 171 if (i != services_.end()) { |
| 170 // The entry exists. | 172 // The entry exists. |
| 171 delete i->second; | 173 delete i->second; |
| 172 } | 174 } |
| 173 | 175 |
| 174 services_[id] = entry; | 176 services_[id] = entry; |
| 175 return entry; | 177 return entry; |
| 176 } | 178 } |
| 179 |
| 180 URLFetcherProtectManager::URLFetcherProtectManager() {} |
| OLD | NEW |