summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-02 20:40:49 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-10-02 20:40:49 +0000
commit82b28308c492d4f4ae6077fb42757be27caa60bf (patch)
tree502a47f79e671d75dec0335d2fad334873ec33f1
parent57cc7b2d90e6cfee9079f23281cd78f23fc961c2 (diff)
downloadchromium_src-82b28308c492d4f4ae6077fb42757be27caa60bf.zip
chromium_src-82b28308c492d4f4ae6077fb42757be27caa60bf.tar.gz
chromium_src-82b28308c492d4f4ae6077fb42757be27caa60bf.tar.bz2
Remove the network state notifier and the corresponding DLL. This is likely causing some startup performance regressions, and we don't really need it now anyway. We should have a different design when we implement this in the future.
BUG=3076 Review URL: http://codereview.chromium.org/6404 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2808 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--build/internal/essential.vsprops2
-rw-r--r--webkit/port/platform/network/NetworkStateNotifierWin.cpp65
2 files changed, 6 insertions, 61 deletions
diff --git a/build/internal/essential.vsprops b/build/internal/essential.vsprops
index 0264286..21460a9 100644
--- a/build/internal/essential.vsprops
+++ b/build/internal/essential.vsprops
@@ -30,7 +30,7 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/safeseh /dynamicbase /ignore:4199 /ignore:4221 /nxcompat"
- AdditionalDependencies="wininet.lib version.lib msimg32.lib ws2_32.lib usp10.lib psapi.lib iphlpapi.lib"
+ AdditionalDependencies="wininet.lib version.lib msimg32.lib ws2_32.lib usp10.lib psapi.lib"
AdditionalLibraryDirectories="$(SDKLibs)"
DelayLoadDLLs="dwmapi.dll,uxtheme.dll"
GenerateDebugInformation="true"
diff --git a/webkit/port/platform/network/NetworkStateNotifierWin.cpp b/webkit/port/platform/network/NetworkStateNotifierWin.cpp
index ba2d3ee..72104bb 100644
--- a/webkit/port/platform/network/NetworkStateNotifierWin.cpp
+++ b/webkit/port/platform/network/NetworkStateNotifierWin.cpp
@@ -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 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();
}
}