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

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

Issue 7825026: Revert "Currently, base/timer.cc calls PostTask with FROM_HERE as the Location, (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « media/filters/adaptive_demuxer.cc ('k') | net/curvecp/messenger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/logging.h" 10 #include "base/logging.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 146
147 void NetworkChangeNotifierWin::OnObjectSignaled(HANDLE object) { 147 void NetworkChangeNotifierWin::OnObjectSignaled(HANDLE object) {
148 NotifyObserversOfIPAddressChange(); 148 NotifyObserversOfIPAddressChange();
149 149
150 // Calling IsOffline() at this very moment is likely to give 150 // Calling IsOffline() at this very moment is likely to give
151 // the wrong result, so we delay that until a little bit later. 151 // the wrong result, so we delay that until a little bit later.
152 // 152 //
153 // The one second delay chosen here was determined experimentally 153 // The one second delay chosen here was determined experimentally
154 // by adamk on Windows 7. 154 // by adamk on Windows 7.
155 timer_.Stop(); // cancel any already waiting notification 155 timer_.Stop(); // cancel any already waiting notification
156 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(1), this, 156 timer_.Start(base::TimeDelta::FromSeconds(1), this,
157 &NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange); 157 &NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange);
158 158
159 // Start watching for the next address change. 159 // Start watching for the next address change.
160 WatchForAddressChange(); 160 WatchForAddressChange();
161 } 161 }
162 162
163 void NetworkChangeNotifierWin::WatchForAddressChange() { 163 void NetworkChangeNotifierWin::WatchForAddressChange() {
164 HANDLE handle = NULL; 164 HANDLE handle = NULL;
165 DWORD ret = NotifyAddrChange(&handle, &addr_overlapped_); 165 DWORD ret = NotifyAddrChange(&handle, &addr_overlapped_);
166 CHECK_EQ(static_cast<DWORD>(ERROR_IO_PENDING), ret); 166 CHECK_EQ(static_cast<DWORD>(ERROR_IO_PENDING), ret);
167 addr_watcher_.StartWatching(addr_overlapped_.hEvent, this); 167 addr_watcher_.StartWatching(addr_overlapped_.hEvent, this);
168 } 168 }
169 169
170 void NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange() { 170 void NetworkChangeNotifierWin::NotifyParentOfOnlineStateChange() {
171 NotifyObserversOfOnlineStateChange(); 171 NotifyObserversOfOnlineStateChange();
172 } 172 }
173 173
174 } // namespace net 174 } // namespace net
OLDNEW
« no previous file with comments | « media/filters/adaptive_demuxer.cc ('k') | net/curvecp/messenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698