Title: [110669] trunk/Source/WebCore
Revision
110669
Author
[email protected]
Date
2012-03-14 00:23:49 -0700 (Wed, 14 Mar 2012)

Log Message

[GTK] Use the same DNS prefetching path than the other ports.
https://bugs.webkit.org/show_bug.cgi?id=80997

Reviewed by Martin Robinson.

This patch basically reverts r56128. There is no need to add an
special code path for GTK+ DNS pre-fetching because the main
reason to do that (some potential changes in libsoup) is not
going to happen. It also reduces the amount of DNS queries by
adding a NULL hostname check.

No need for new tests as this just moves code around.

* GNUmakefile.list.am:
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::parseAttribute):
* html/HTMLLinkElement.cpp:
* loader/LinkLoader.cpp:
(WebCore::LinkLoader::loadLink):
* page/Chrome.cpp:
(WebCore::Chrome::mouseDidMoveOverElement):
* platform/network/DNS.h:
(WebCore):
* platform/network/ResourceHandle.cpp:
* platform/network/ResourceHandle.h:
(ResourceHandle):
* platform/network/chromium/DNSChromium.cpp:
* platform/network/soup/DNSSoup.cpp: restored.
(WebCore):
(WebCore::prefetchDNS):
* platform/network/soup/ResourceHandleSoup.cpp:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110668 => 110669)


--- trunk/Source/WebCore/ChangeLog	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/ChangeLog	2012-03-14 07:23:49 UTC (rev 110669)
@@ -1,3 +1,37 @@
+2012-03-13  Sergio Villar Senin  <[email protected]>
+
+        [GTK] Use the same DNS prefetching path than the other ports.
+        https://bugs.webkit.org/show_bug.cgi?id=80997
+
+        Reviewed by Martin Robinson.
+
+        This patch basically reverts r56128. There is no need to add an
+        special code path for GTK+ DNS pre-fetching because the main
+        reason to do that (some potential changes in libsoup) is not
+        going to happen. It also reduces the amount of DNS queries by
+        adding a NULL hostname check.
+
+        No need for new tests as this just moves code around.
+
+        * GNUmakefile.list.am:
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::parseAttribute):
+        * html/HTMLLinkElement.cpp:
+        * loader/LinkLoader.cpp:
+        (WebCore::LinkLoader::loadLink):
+        * page/Chrome.cpp:
+        (WebCore::Chrome::mouseDidMoveOverElement):
+        * platform/network/DNS.h:
+        (WebCore):
+        * platform/network/ResourceHandle.cpp:
+        * platform/network/ResourceHandle.h:
+        (ResourceHandle):
+        * platform/network/chromium/DNSChromium.cpp:
+        * platform/network/soup/DNSSoup.cpp: restored.
+        (WebCore):
+        (WebCore::prefetchDNS):
+        * platform/network/soup/ResourceHandleSoup.cpp:
+
 2012-03-14  Kentaro Hara  <[email protected]>
 
         Return null when shouldAllowAccessToNode() fails

Modified: trunk/Source/WebCore/GNUmakefile.list.am (110668 => 110669)


--- trunk/Source/WebCore/GNUmakefile.list.am	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/GNUmakefile.list.am	2012-03-14 07:23:49 UTC (rev 110669)
@@ -3396,6 +3396,7 @@
 	Source/WebCore/platform/network/soup/CookieJarSoup.cpp \
 	Source/WebCore/platform/network/soup/CookieJarSoup.h \
 	Source/WebCore/platform/network/soup/CredentialStorageSoup.cpp \
+	Source/WebCore/platform/network/soup/DNSSoup.cpp \
 	Source/WebCore/platform/network/soup/GOwnPtrSoup.cpp \
 	Source/WebCore/platform/network/soup/GOwnPtrSoup.h \
 	Source/WebCore/platform/network/soup/ProxyServerSoup.cpp \

Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (110668 => 110669)


--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp	2012-03-14 07:23:49 UTC (rev 110669)
@@ -25,6 +25,7 @@
 #include "HTMLAnchorElement.h"
 
 #include "Attribute.h"
+#include "DNS.h"
 #include "EventNames.h"
 #include "Frame.h"
 #include "FrameLoaderClient.h"
@@ -37,7 +38,6 @@
 #include "Page.h"
 #include "PingLoader.h"
 #include "RenderImage.h"
-#include "ResourceHandle.h"
 #include "SecurityOrigin.h"
 #include "SecurityPolicy.h"
 #include "Settings.h"
@@ -221,7 +221,7 @@
             String parsedURL = stripLeadingAndTrailingHTMLSpaces(attr->value());
             if (document()->isDNSPrefetchEnabled()) {
                 if (protocolIs(parsedURL, "http") || protocolIs(parsedURL, "https") || parsedURL.startsWith("//"))
-                    ResourceHandle::prepareForURL(document()->completeURL(parsedURL));
+                    prefetchDNS(document()->completeURL(parsedURL).host());
             }
             if (document()->page() && !document()->page()->_javascript_URLsAreAllowed() && protocolIsJavaScript(parsedURL)) {
                 clearIsLink();

Modified: trunk/Source/WebCore/html/HTMLLinkElement.cpp (110668 => 110669)


--- trunk/Source/WebCore/html/HTMLLinkElement.cpp	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/html/HTMLLinkElement.cpp	2012-03-14 07:23:49 UTC (rev 110669)
@@ -42,7 +42,6 @@
 #include "MediaList.h"
 #include "MediaQueryEvaluator.h"
 #include "Page.h"
-#include "ResourceHandle.h"
 #include "ScriptEventListener.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"

Modified: trunk/Source/WebCore/loader/LinkLoader.cpp (110668 => 110669)


--- trunk/Source/WebCore/loader/LinkLoader.cpp	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/loader/LinkLoader.cpp	2012-03-14 07:23:49 UTC (rev 110669)
@@ -37,11 +37,11 @@
 #include "CachedCSSStyleSheet.h"
 #include "CachedResourceLoader.h"
 #include "ContainerNode.h"
+#include "DNS.h"
 #include "Document.h"
 #include "Frame.h"
 #include "FrameView.h"
 #include "LinkRelAttribute.h"
-#include "ResourceHandle.h"
 #include "Settings.h"
 
 namespace WebCore {
@@ -99,7 +99,7 @@
         // FIXME: The href attribute of the link element can be in "//hostname" form, and we shouldn't attempt
         // to complete that as URL <https://bugs.webkit.org/show_bug.cgi?id=48857>.
         if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && !href.isEmpty())
-            ResourceHandle::prepareForURL(href);
+            prefetchDNS(href.host());
     }
 
 #if ENABLE(LINK_PREFETCH)

Modified: trunk/Source/WebCore/page/Chrome.cpp (110668 => 110669)


--- trunk/Source/WebCore/page/Chrome.cpp	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/page/Chrome.cpp	2012-03-14 07:23:49 UTC (rev 110669)
@@ -373,7 +373,7 @@
     if (result.innerNode()) {
         Document* document = result.innerNode()->document();
         if (document && document->isDNSPrefetchEnabled())
-            ResourceHandle::prepareForURL(result.absoluteLinkURL());
+            prefetchDNS(result.absoluteLinkURL().host());
     }
     m_client->mouseDidMoveOverElement(result, modifierFlags);
 

Modified: trunk/Source/WebCore/platform/network/DNS.h (110668 => 110669)


--- trunk/Source/WebCore/platform/network/DNS.h	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/platform/network/DNS.h	2012-03-14 07:23:49 UTC (rev 110669)
@@ -30,9 +30,7 @@
 
 namespace WebCore {
 
-#if !USE(SOUP)
-    void prefetchDNS(const String& hostname);
-#endif
+void prefetchDNS(const String& hostname);
 }
 
 #endif

Modified: trunk/Source/WebCore/platform/network/ResourceHandle.cpp (110668 => 110669)


--- trunk/Source/WebCore/platform/network/ResourceHandle.cpp	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.cpp	2012-03-14 07:23:49 UTC (rev 110669)
@@ -28,7 +28,6 @@
 #include "ResourceHandleInternal.h"
 
 #include "BlobRegistry.h"
-#include "DNS.h"
 #include "Logging.h"
 #include "ResourceHandleClient.h"
 #include "Timer.h"
@@ -185,13 +184,6 @@
     platformSetDefersLoading(defers);
 }
 
-#if !USE(SOUP)
-void ResourceHandle::prepareForURL(const KURL& url)
-{
-    return prefetchDNS(url.host());
-}
-#endif
-
 void ResourceHandle::cacheMetadata(const ResourceResponse&, const Vector<char>&)
 {
     // Optionally implemented by platform.

Modified: trunk/Source/WebCore/platform/network/ResourceHandle.h (110668 => 110669)


--- trunk/Source/WebCore/platform/network/ResourceHandle.h	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/platform/network/ResourceHandle.h	2012-03-14 07:23:49 UTC (rev 110669)
@@ -104,7 +104,6 @@
     static PassRefPtr<ResourceHandle> create(NetworkingContext*, const ResourceRequest&, ResourceHandleClient*, bool defersLoading, bool shouldContentSniff);
     static void loadResourceSynchronously(NetworkingContext*, const ResourceRequest&, StoredCredentials, ResourceError&, ResourceResponse&, Vector<char>& data);
 
-    static void prepareForURL(const KURL&);
     static bool willLoadFromCache(ResourceRequest&, Frame*);
     static void cacheMetadata(const ResourceResponse&, const Vector<char>&);
 #if PLATFORM(MAC)

Modified: trunk/Source/WebCore/platform/network/chromium/DNSChromium.cpp (110668 => 110669)


--- trunk/Source/WebCore/platform/network/chromium/DNSChromium.cpp	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/platform/network/chromium/DNSChromium.cpp	2012-03-14 07:23:49 UTC (rev 110669)
@@ -27,7 +27,6 @@
 #include "DNS.h"
 
 #include "PlatformSupport.h"
-#include "ResourceHandle.h"
 
 namespace WebCore {
 
@@ -36,9 +35,4 @@
     PlatformSupport::prefetchDNS(hostname);
 }
 
-void ResourceHandle::prepareForURL(const KURL& url)
-{
-    return prefetchDNS(url.host());
-}
-
 } // namespace WebCore

Copied: trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp (from rev 110668, trunk/Source/WebCore/platform/network/chromium/DNSChromium.cpp) (0 => 110669)


--- trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp	                        (rev 0)
+++ trunk/Source/WebCore/platform/network/soup/DNSSoup.cpp	2012-03-14 07:23:49 UTC (rev 110669)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2008 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2009, 2012 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include "config.h"
+#include "DNS.h"
+
+#include "CString.h"
+#include "GOwnPtrSoup.h"
+#include "ResourceHandle.h"
+
+namespace WebCore {
+
+void prefetchDNS(const String& hostname)
+{
+    if (hostname.isEmpty())
+        return;
+
+    String uri = "http://" + hostname;
+    GOwnPtr<SoupURI> soupURI(soup_uri_new(uri.utf8().data()));
+    if (!soupURI)
+        return;
+
+    soup_session_prepare_for_uri(ResourceHandle::defaultSession(), soupURI.get());
+}
+
+}

Modified: trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp (110668 => 110669)


--- trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-03-14 07:11:22 UTC (rev 110668)
+++ trunk/Source/WebCore/platform/network/soup/ResourceHandleSoup.cpp	2012-03-14 07:23:49 UTC (rev 110669)
@@ -179,14 +179,6 @@
     g_object_set_data(G_OBJECT(session), "webkit-init", reinterpret_cast<void*>(0xdeadbeef));
 }
 
-void ResourceHandle::prepareForURL(const KURL& url)
-{
-    GOwnPtr<SoupURI> soupURI(soup_uri_new(url.string().utf8().data()));
-    if (!soupURI)
-        return;
-    soup_session_prepare_for_uri(ResourceHandle::defaultSession(), soupURI.get());
-}
-
 // Called each time the message is going to be sent again except the first time.
 // It's used mostly to let webkit know about redirects.
 static void restartedCallback(SoupMessage* msg, gpointer data)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to