Title: [132664] trunk/Source/WebCore
- Revision
- 132664
- Author
- [email protected]
- Date
- 2012-10-26 08:49:30 -0700 (Fri, 26 Oct 2012)
Log Message
Lots of time spent under DNSResolveQueue::platformProxyIsEnabledInSystemPreferences
https://bugs.webkit.org/show_bug.cgi?id=100514
Reviewed by Anders Carlsson.
DNSResolveQueue::platformProxyIsEnabledInSystemPreferences gets called for every link in
the document. The function is relatively slow.
This patch caches the result of the last check for 5 seconds. Based on code comments
prefetching is disabled with proxies due to regressing performance with some configurations.
Proxy status changes rarely and a slight reaction delay shoudn't cause practical problems.
* platform/network/DNSResolveQueue.cpp:
(WebCore::DNSResolveQueue::DNSResolveQueue):
Add constructor. Also fixes a bug, m_requestsInFlight was not initialized.
(WebCore):
(WebCore::DNSResolveQueue::isUsingProxy):
(WebCore::DNSResolveQueue::add):
(WebCore::DNSResolveQueue::fired):
* platform/network/DNSResolveQueue.h:
(DNSResolveQueue):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (132663 => 132664)
--- trunk/Source/WebCore/ChangeLog 2012-10-26 15:42:49 UTC (rev 132663)
+++ trunk/Source/WebCore/ChangeLog 2012-10-26 15:49:30 UTC (rev 132664)
@@ -1,3 +1,29 @@
+2012-10-26 Antti Koivisto <[email protected]>
+
+ Lots of time spent under DNSResolveQueue::platformProxyIsEnabledInSystemPreferences
+ https://bugs.webkit.org/show_bug.cgi?id=100514
+
+ Reviewed by Anders Carlsson.
+
+ DNSResolveQueue::platformProxyIsEnabledInSystemPreferences gets called for every link in
+ the document. The function is relatively slow.
+
+ This patch caches the result of the last check for 5 seconds. Based on code comments
+ prefetching is disabled with proxies due to regressing performance with some configurations.
+ Proxy status changes rarely and a slight reaction delay shoudn't cause practical problems.
+
+ * platform/network/DNSResolveQueue.cpp:
+ (WebCore::DNSResolveQueue::DNSResolveQueue):
+
+ Add constructor. Also fixes a bug, m_requestsInFlight was not initialized.
+
+ (WebCore):
+ (WebCore::DNSResolveQueue::isUsingProxy):
+ (WebCore::DNSResolveQueue::add):
+ (WebCore::DNSResolveQueue::fired):
+ * platform/network/DNSResolveQueue.h:
+ (DNSResolveQueue):
+
2012-10-26 Sheriff Bot <[email protected]>
Unreviewed, rolling out r132662.
Modified: trunk/Source/WebCore/platform/network/DNSResolveQueue.cpp (132663 => 132664)
--- trunk/Source/WebCore/platform/network/DNSResolveQueue.cpp 2012-10-26 15:42:49 UTC (rev 132663)
+++ trunk/Source/WebCore/platform/network/DNSResolveQueue.cpp 2012-10-26 15:49:30 UTC (rev 132664)
@@ -27,6 +27,8 @@
#include "config.h"
#include "DNSResolveQueue.h"
+#include <wtf/CurrentTime.h>
+
namespace WebCore {
// When resolve queue is empty, we fire async resolution requests immediately (which is important if the prefetch is triggered by hovering).
@@ -47,13 +49,30 @@
// If there were queued names that couldn't be sent simultaneously, check the state of resolvers after this delay.
static const double gRetryResolvingInSeconds = 0.1;
+DNSResolveQueue::DNSResolveQueue()
+ : m_requestsInFlight(0)
+ , m_cachedProxyEnabledStatus(false)
+ , m_lastProxyEnabledStatusCheckTime(0)
+{
+}
+
+bool DNSResolveQueue::isUsingProxy()
+{
+ double time = currentTime();
+ static const double minimumProxyCheckDelay = 5;
+ if (time - m_lastProxyEnabledStatusCheckTime > minimumProxyCheckDelay) {
+ m_lastProxyEnabledStatusCheckTime = time;
+ m_cachedProxyEnabledStatus = platformProxyIsEnabledInSystemPreferences();
+ }
+ return m_cachedProxyEnabledStatus;
+}
+
void DNSResolveQueue::add(const String& hostname)
{
// If there are no names queued, and few enough are in flight, resolve immediately (the mouse may be over a link).
if (!m_names.size()) {
- if (platformProxyIsEnabledInSystemPreferences())
+ if (isUsingProxy())
return;
-
if (atomicIncrement(&m_requestsInFlight) <= gNamesToResolveImmediately) {
platformResolve(hostname);
return;
@@ -72,7 +91,7 @@
void DNSResolveQueue::fired()
{
- if (platformProxyIsEnabledInSystemPreferences()) {
+ if (isUsingProxy()) {
m_names.clear();
return;
}
Modified: trunk/Source/WebCore/platform/network/DNSResolveQueue.h (132663 => 132664)
--- trunk/Source/WebCore/platform/network/DNSResolveQueue.h 2012-10-26 15:42:49 UTC (rev 132663)
+++ trunk/Source/WebCore/platform/network/DNSResolveQueue.h 2012-10-26 15:49:30 UTC (rev 132664)
@@ -50,6 +50,10 @@
}
private:
+ DNSResolveQueue();
+
+ bool isUsingProxy();
+
bool platformProxyIsEnabledInSystemPreferences();
void platformResolve(const String&);
@@ -57,6 +61,8 @@
HashSet<String> m_names;
int m_requestsInFlight;
+ bool m_cachedProxyEnabledStatus;
+ double m_lastProxyEnabledStatusCheckTime;
};
}
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes