| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_change_notifier_win.h" | 5 #include "net/base/network_change_notifier_win.h" |
| 6 | 6 |
| 7 #include <iphlpapi.h> | 7 #include <iphlpapi.h> |
| 8 #include <winsock2.h> | 8 #include <winsock2.h> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // retry interval. | 197 // retry interval. |
| 198 if (sequential_failures_ == 2000) { | 198 if (sequential_failures_ == 2000) { |
| 199 UMA_HISTOGRAM_COUNTS_10000("Net.NotifyAddrChangeFailures", | 199 UMA_HISTOGRAM_COUNTS_10000("Net.NotifyAddrChangeFailures", |
| 200 sequential_failures_); | 200 sequential_failures_); |
| 201 } | 201 } |
| 202 | 202 |
| 203 MessageLoop::current()->PostDelayedTask( | 203 MessageLoop::current()->PostDelayedTask( |
| 204 FROM_HERE, | 204 FROM_HERE, |
| 205 base::Bind(&NetworkChangeNotifierWin::WatchForAddressChange, | 205 base::Bind(&NetworkChangeNotifierWin::WatchForAddressChange, |
| 206 weak_factory_.GetWeakPtr()), | 206 weak_factory_.GetWeakPtr()), |
| 207 kWatchForAddressChangeRetryIntervalMs); | 207 base::TimeDelta::FromMilliseconds( |
| 208 kWatchForAddressChangeRetryIntervalMs)); |
| 208 return; | 209 return; |
| 209 } | 210 } |
| 210 | 211 |
| 211 // Treat the transition from NotifyAddrChange failing to succeeding as a | 212 // Treat the transition from NotifyAddrChange failing to succeeding as a |
| 212 // network change event, since network changes were not being observed in | 213 // network change event, since network changes were not being observed in |
| 213 // that interval. | 214 // that interval. |
| 214 if (sequential_failures_ > 0) | 215 if (sequential_failures_ > 0) |
| 215 NotifyObservers(); | 216 NotifyObservers(); |
| 216 | 217 |
| 217 if (sequential_failures_ < 2000) { | 218 if (sequential_failures_ < 2000) { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 232 | 233 |
| 233 addr_watcher_.StartWatching(addr_overlapped_.hEvent, this); | 234 addr_watcher_.StartWatching(addr_overlapped_.hEvent, this); |
| 234 return true; | 235 return true; |
| 235 } | 236 } |
| 236 | 237 |
| 237 void NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange() { | 238 void NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange() { |
| 238 NotifyObserversOfOnlineStateChange(); | 239 NotifyObserversOfOnlineStateChange(); |
| 239 } | 240 } |
| 240 | 241 |
| 241 } // namespace net | 242 } // namespace net |
| OLD | NEW |