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

Unified Diff: net/base/network_change_notifier_win.cc

Issue 6526059: Plumb through NetworkChangeNotifier::IsOffline() to WebKit, enabling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: No tests yet Created 9 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/base/network_change_notifier.cc ('k') | net/proxy/proxy_service.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/network_change_notifier_win.cc
diff --git a/net/base/network_change_notifier_win.cc b/net/base/network_change_notifier_win.cc
index bc906cb8a61c32e115d9e7e1c665b83882f14680..e4e02c7f1d96312cfd442c1dfb587814ab91f184 100644
--- a/net/base/network_change_notifier_win.cc
+++ b/net/base/network_change_notifier_win.cc
@@ -8,6 +8,8 @@
#include <winsock2.h>
#include "base/logging.h"
+#include "base/message_loop.h"
+#include "base/task.h"
#include "net/base/winsock_init.h"
#pragma comment(lib, "iphlpapi.lib")
@@ -146,6 +148,16 @@ bool NetworkChangeNotifierWin::IsCurrentlyOffline() const {
void NetworkChangeNotifierWin::OnObjectSignaled(HANDLE object) {
NotifyObserversOfIPAddressChange();
+ // Calling IsOffline() at this very moment is likely to give
+ // the wrong result, so we delay that until a little bit later.
+ //
+ // The one second delay chosen here was determined experimentally
+ // by adamk on Windows 7.
+ MessageLoop::current()->PostDelayedTask(
eroman 2011/03/01 05:23:10 I suggest adding a bit to keep track of the outsta
adamk 2011/03/01 19:20:06 Thanks for the tip, replaced with a OneShotTimer.
+ FROM_HERE,
+ NewRunnableFunction(&NotifyObserversOfOnlineStateChange),
+ 1000);
+
// Start watching for the next address change.
WatchForAddressChange();
}
« no previous file with comments | « net/base/network_change_notifier.cc ('k') | net/proxy/proxy_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698