| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/metrics/histogram.h" | 12 #include "base/metrics/histogram.h" |
| 13 #include "base/profiler/scoped_profile.h" | 13 #include "base/profiler/scoped_tracker.h" |
| 14 #include "base/threading/thread.h" | 14 #include "base/threading/thread.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "net/base/winsock_init.h" | 16 #include "net/base/winsock_init.h" |
| 17 #include "net/dns/dns_config_service.h" | 17 #include "net/dns/dns_config_service.h" |
| 18 | 18 |
| 19 #pragma comment(lib, "iphlpapi.lib") | 19 #pragma comment(lib, "iphlpapi.lib") |
| 20 | 20 |
| 21 namespace net { | 21 namespace net { |
| 22 | 22 |
| 23 namespace { | 23 namespace { |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 return last_computed_connection_type_; | 212 return last_computed_connection_type_; |
| 213 } | 213 } |
| 214 | 214 |
| 215 void NetworkChangeNotifierWin::SetCurrentConnectionType( | 215 void NetworkChangeNotifierWin::SetCurrentConnectionType( |
| 216 ConnectionType connection_type) { | 216 ConnectionType connection_type) { |
| 217 base::AutoLock auto_lock(last_computed_connection_type_lock_); | 217 base::AutoLock auto_lock(last_computed_connection_type_lock_); |
| 218 last_computed_connection_type_ = connection_type; | 218 last_computed_connection_type_ = connection_type; |
| 219 } | 219 } |
| 220 | 220 |
| 221 void NetworkChangeNotifierWin::OnObjectSignaled(HANDLE object) { | 221 void NetworkChangeNotifierWin::OnObjectSignaled(HANDLE object) { |
| 222 // TODO(vadimt): Remove ScopedProfile below once crbug.com/418183 is fixed. | 222 // TODO(vadimt): Remove ScopedTracker below once crbug.com/418183 is fixed. |
| 223 tracked_objects::ScopedProfile tracking_profile( | 223 tracked_objects::ScopedTracker tracking_profile( |
| 224 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 224 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 225 "NetworkChangeNotifierWin_OnObjectSignaled")); | 225 "NetworkChangeNotifierWin_OnObjectSignaled")); |
| 226 | 226 |
| 227 DCHECK(CalledOnValidThread()); | 227 DCHECK(CalledOnValidThread()); |
| 228 DCHECK(is_watching_); | 228 DCHECK(is_watching_); |
| 229 is_watching_ = false; | 229 is_watching_ = false; |
| 230 | 230 |
| 231 // Start watching for the next address change. | 231 // Start watching for the next address change. |
| 232 WatchForAddressChange(); | 232 WatchForAddressChange(); |
| 233 | 233 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 324 return; | 324 return; |
| 325 } | 325 } |
| 326 if (last_announced_offline_) | 326 if (last_announced_offline_) |
| 327 UMA_HISTOGRAM_CUSTOM_COUNTS("NCN.OfflinePolls", offline_polls_, 1, 50, 50); | 327 UMA_HISTOGRAM_CUSTOM_COUNTS("NCN.OfflinePolls", offline_polls_, 1, 50, 50); |
| 328 last_announced_offline_ = current_offline; | 328 last_announced_offline_ = current_offline; |
| 329 | 329 |
| 330 NotifyObserversOfConnectionTypeChange(); | 330 NotifyObserversOfConnectionTypeChange(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 } // namespace net | 333 } // namespace net |
| OLD | NEW |