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

Unified Diff: webkit/port/platform/network/NetworkStateNotifierWin.cpp

Issue 6404: Remove the network state notifier and the corresponding DLL. This is likely c... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « build/internal/essential.vsprops ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/port/platform/network/NetworkStateNotifierWin.cpp
===================================================================
--- webkit/port/platform/network/NetworkStateNotifierWin.cpp (revision 2798)
+++ webkit/port/platform/network/NetworkStateNotifierWin.cpp (working copy)
@@ -26,90 +26,35 @@
#include "config.h"
#include "NetworkStateNotifier.h"
-#include <wtf/MainThread.h>
-#include <wtf/Vector.h>
-
-#include <winsock2.h>
-#include <iphlpapi.h>
-
namespace WebCore {
+// Chromium doesn't currently support network state notifications. This cuases
M-A Ruel 2008/10/02 20:35:09 causes
+// an extra DLL to get loaded into the renderer which can slow things down a
+// bit. We may want an alternate design.
+
void NetworkStateNotifier::updateState()
{
- // Assume that we're online until proven otherwise.
- m_isOnLine = true;
- return;
-
- Vector<char> buffer;
- DWORD size = 0;
-
- if (::GetAdaptersAddresses(AF_UNSPEC, 0, 0, 0, &size) != ERROR_BUFFER_OVERFLOW)
- return;
-
- buffer.resize(size);
- PIP_ADAPTER_ADDRESSES addresses = reinterpret_cast<PIP_ADAPTER_ADDRESSES>(buffer.data());
-
- if (::GetAdaptersAddresses(AF_UNSPEC, 0, 0, addresses, &size) != ERROR_SUCCESS) {
- // We couldn't determine whether we're online or not, so assume that we are.
- return;
- }
-
- for (; addresses; addresses = addresses->Next) {
- if (addresses->IfType == MIB_IF_TYPE_LOOPBACK)
- continue;
-
- if (addresses->OperStatus != IfOperStatusUp)
- continue;
-
- // We found an interface that was up.
- return;
- }
-
- // We didn't find any valid interfaces, so we must be offline.
- m_isOnLine = false;
}
void NetworkStateNotifier::addressChanged()
{
- bool oldOnLine = m_isOnLine;
-
- updateState();
-
- if (m_isOnLine == oldOnLine)
- return;
-
- if (m_networkStateChangedFunction)
- m_networkStateChangedFunction();
}
void NetworkStateNotifier::callAddressChanged(void* context)
{
- static_cast<NetworkStateNotifier*>(context)->addressChanged();
}
void CALLBACK NetworkStateNotifier::addrChangeCallback(void* context, BOOLEAN timedOut)
{
- callOnMainThread(callAddressChanged, context);
}
void NetworkStateNotifier::registerForAddressChange()
{
- HANDLE handle;
- ::NotifyAddrChange(&handle, &m_overlapped);
}
NetworkStateNotifier::NetworkStateNotifier()
- : m_isOnLine(false)
+ : m_isOnLine(true)
{
- updateState();
-
- memset(&m_overlapped, 0, sizeof(m_overlapped));
-
- m_overlapped.hEvent = ::CreateEvent(0, false, false, 0);
-
- ::RegisterWaitForSingleObject(&m_waitHandle, m_overlapped.hEvent, addrChangeCallback, this, INFINITE, 0);
-
- registerForAddressChange();
}
}
« no previous file with comments | « build/internal/essential.vsprops ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698