Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: net/base/network_change_notifier_win.cc

Issue 1350023003: Add a Mojo EDK for Chrome that uses one OS pipe per message pipe. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: move to mojo::edk namespace in preparation for runtim flag Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 if (!dns_config_service_thread_->IsRunning()) { 289 if (!dns_config_service_thread_->IsRunning()) {
290 dns_config_service_thread_->StartWithOptions( 290 dns_config_service_thread_->StartWithOptions(
291 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); 291 base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
292 } 292 }
293 293
294 HANDLE handle = NULL; 294 HANDLE handle = NULL;
295 DWORD ret = NotifyAddrChange(&handle, &addr_overlapped_); 295 DWORD ret = NotifyAddrChange(&handle, &addr_overlapped_);
296 if (ret != ERROR_IO_PENDING) 296 if (ret != ERROR_IO_PENDING)
297 return false; 297 return false;
298 298
299 addr_watcher_.StartWatching(addr_overlapped_.hEvent, this); 299 addr_watcher_.StartWatching(addr_overlapped_.hEvent, this, false);
300 return true; 300 return true;
301 } 301 }
302 302
303 void NetworkChangeNotifierWin::NotifyParentOfConnectionTypeChange() { 303 void NetworkChangeNotifierWin::NotifyParentOfConnectionTypeChange() {
304 SetCurrentConnectionType(RecomputeCurrentConnectionType()); 304 SetCurrentConnectionType(RecomputeCurrentConnectionType());
305 bool current_offline = IsOffline(); 305 bool current_offline = IsOffline();
306 offline_polls_++; 306 offline_polls_++;
307 // If we continue to appear offline, delay sending out the notification in 307 // If we continue to appear offline, delay sending out the notification in
308 // case we appear to go online within 20 seconds. UMA histogram data shows 308 // case we appear to go online within 20 seconds. UMA histogram data shows
309 // we may not detect the transition to online state after 1 second but within 309 // we may not detect the transition to online state after 1 second but within
310 // 20 seconds we generally do. 310 // 20 seconds we generally do.
311 if (last_announced_offline_ && current_offline && offline_polls_ <= 20) { 311 if (last_announced_offline_ && current_offline && offline_polls_ <= 20) {
312 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this, 312 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this,
313 &NetworkChangeNotifierWin::NotifyParentOfConnectionTypeChange); 313 &NetworkChangeNotifierWin::NotifyParentOfConnectionTypeChange);
314 return; 314 return;
315 } 315 }
316 if (last_announced_offline_) 316 if (last_announced_offline_)
317 UMA_HISTOGRAM_CUSTOM_COUNTS("NCN.OfflinePolls", offline_polls_, 1, 50, 50); 317 UMA_HISTOGRAM_CUSTOM_COUNTS("NCN.OfflinePolls", offline_polls_, 1, 50, 50);
318 last_announced_offline_ = current_offline; 318 last_announced_offline_ = current_offline;
319 319
320 NotifyObserversOfConnectionTypeChange(); 320 NotifyObserversOfConnectionTypeChange();
321 } 321 }
322 322
323 } // namespace net 323 } // namespace net
OLDNEW
« mojo/edk/system/raw_channel_win.cc ('K') | « net/DEPS ('k') | net/socket/tcp_socket_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698