Changeset 188331 in webkit


Ignore:
Timestamp:
Aug 12, 2015, 12:13:01 AM (10 years ago)
Author:
Carlos Garcia Campos
Message:

NetworkProcess: DNS prefetch happens in the Web Process
https://bugs.webkit.org/show_bug.cgi?id=147824

Reviewed by Alexey Proskuryakov.

Source/WebCore:

Use FrameLoaderClient to do the DNS prefetch.

  • html/HTMLAnchorElement.cpp:

(WebCore::HTMLAnchorElement::parseAttribute):

  • loader/FrameLoaderClient.h:
  • loader/LinkLoader.cpp:

(WebCore::LinkLoader::loadLink):

  • page/Chrome.cpp:

(WebCore::Chrome::mouseDidMoveOverElement):

Source/WebKit2:

DNS prefetch requests started in the WebProcess should be sent to
the network process when it's enabled.

  • NetworkProcess/NetworkConnectionToWebProcess.cpp:

(WebKit::NetworkConnectionToWebProcess::prefetchDNS): Do the
actual DNS prefetch.

  • NetworkProcess/NetworkConnectionToWebProcess.h:
  • NetworkProcess/NetworkConnectionToWebProcess.messages.in: Add

PrefetchDNS message.

  • WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:

(webkitWebExtensionDidReceiveMessage): Use WebProcess::prefetchDNS().

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:

(WebKit::WebFrameLoaderClient::prefetchDNS): Ditto.

  • WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::sendTapHighlightForNodeIfNecessary): Use
FrameLoaderClient to do the DNS prefetch.

  • WebProcess/WebProcess.cpp:

(WebKit::WebProcess::prefetchDNS): Send the request to the network
process if it's enabled, otherwise do the actual DNS prefetch.

  • WebProcess/WebProcess.h:
Location:
trunk/Source
Files:
15 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r188329 r188331  
     12015-08-11  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        NetworkProcess: DNS prefetch happens in the Web Process
     4        https://bugs.webkit.org/show_bug.cgi?id=147824
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        Use FrameLoaderClient to do the DNS prefetch.
     9
     10        * html/HTMLAnchorElement.cpp:
     11        (WebCore::HTMLAnchorElement::parseAttribute):
     12        * loader/FrameLoaderClient.h:
     13        * loader/LinkLoader.cpp:
     14        (WebCore::LinkLoader::loadLink):
     15        * page/Chrome.cpp:
     16        (WebCore::Chrome::mouseDidMoveOverElement):
     17
    1182015-08-11  Mark Lam  <mark.lam@apple.com>
    219
  • trunk/Source/WebCore/html/HTMLAnchorElement.cpp

    r185111 r188331  
    2525#include "HTMLAnchorElement.h"
    2626
    27 #include "DNS.h"
    2827#include "ElementIterator.h"
    2928#include "EventHandler.h"
     
    254253        if (isLink()) {
    255254            String parsedURL = stripLeadingAndTrailingHTMLSpaces(value);
    256             if (document().isDNSPrefetchEnabled()) {
     255            if (document().isDNSPrefetchEnabled() && document().frame()) {
    257256                if (protocolIsInHTTPFamily(parsedURL) || parsedURL.startsWith("//"))
    258                     prefetchDNS(document().completeURL(parsedURL).host());
     257                    document().frame()->loader().client().prefetchDNS(document().completeURL(parsedURL).host());
    259258            }
    260259        }
  • trunk/Source/WebCore/loader/FrameLoaderClient.h

    r187002 r188331  
    3131#define FrameLoaderClient_h
    3232
     33#include "DNS.h"
    3334#include "FrameLoaderTypes.h"
    3435#include "IconURL.h"
     
    348349        virtual void contentFilterDidBlockLoad(ContentFilterUnblockHandler) { }
    349350#endif
     351        virtual void prefetchDNS(const String& hostname) { WebCore::prefetchDNS(hostname); }
    350352    };
    351353
  • trunk/Source/WebCore/loader/LinkLoader.cpp

    r183563 r188331  
    3838#include "CachedResourceRequest.h"
    3939#include "ContainerNode.h"
    40 #include "DNS.h"
    4140#include "Document.h"
    4241#include "Frame.h"
     
    9998        // FIXME: The href attribute of the link element can be in "//hostname" form, and we shouldn't attempt
    10099        // to complete that as URL <https://bugs.webkit.org/show_bug.cgi?id=48857>.
    101         if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && !href.isEmpty())
    102             prefetchDNS(href.host());
     100        if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && !href.isEmpty() && document.frame())
     101            document.frame()->loader().client().prefetchDNS(href.host());
    103102    }
    104103
  • trunk/Source/WebCore/page/Chrome.cpp

    r187002 r188331  
    2424
    2525#include "ChromeClient.h"
    26 #include "DNS.h"
    2726#include "Document.h"
    2827#include "DocumentType.h"
     
    3130#include "FileList.h"
    3231#include "FloatRect.h"
     32#include "FrameLoaderClient.h"
    3333#include "FrameTree.h"
    3434#include "Geolocation.h"
     
    351351{
    352352    if (result.innerNode() && result.innerNode()->document().isDNSPrefetchEnabled())
    353         prefetchDNS(result.absoluteLinkURL().host());
     353        m_page.mainFrame().loader().client().prefetchDNS(result.absoluteLinkURL().host());
    354354    m_client.mouseDidMoveOverElement(result, modifierFlags);
    355355
  • trunk/Source/WebKit2/ChangeLog

    r188317 r188331  
     12015-08-11  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        NetworkProcess: DNS prefetch happens in the Web Process
     4        https://bugs.webkit.org/show_bug.cgi?id=147824
     5
     6        Reviewed by Alexey Proskuryakov.
     7
     8        DNS prefetch requests started in the WebProcess should be sent to
     9        the network process when it's enabled.
     10
     11        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
     12        (WebKit::NetworkConnectionToWebProcess::prefetchDNS): Do the
     13        actual DNS prefetch.
     14        * NetworkProcess/NetworkConnectionToWebProcess.h:
     15        * NetworkProcess/NetworkConnectionToWebProcess.messages.in: Add
     16        PrefetchDNS message.
     17        * WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp:
     18        (webkitWebExtensionDidReceiveMessage): Use WebProcess::prefetchDNS().
     19        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     20        (WebKit::WebFrameLoaderClient::prefetchDNS): Ditto.
     21        * WebProcess/WebCoreSupport/WebFrameLoaderClient.h:
     22        * WebProcess/WebPage/ios/WebPageIOS.mm:
     23        (WebKit::WebPage::sendTapHighlightForNodeIfNecessary): Use
     24        FrameLoaderClient to do the DNS prefetch.
     25        * WebProcess/WebProcess.cpp:
     26        (WebKit::WebProcess::prefetchDNS): Send the request to the network
     27        process if it's enabled, otherwise do the actual DNS prefetch.
     28        * WebProcess/WebProcess.h:
     29
    1302015-08-11  Hunseop Jeong  <hs85.jeong@samsung.com>
    231
  • trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp

    r187364 r188331  
    3737#include "RemoteNetworkingContext.h"
    3838#include "SessionTracker.h"
     39#include <WebCore/DNS.h>
    3940#include <WebCore/PingHandle.h>
    4041#include <WebCore/PlatformCookieJar.h>
     
    158159
    159160    loader->setDefersLoading(defers);
     161}
     162
     163void NetworkConnectionToWebProcess::prefetchDNS(const String& hostname)
     164{
     165    WebCore::prefetchDNS(hostname);
    160166}
    161167
  • trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h

    r186530 r188331  
    7474    void performSynchronousLoad(const NetworkResourceLoadParameters&, PassRefPtr<Messages::NetworkConnectionToWebProcess::PerformSynchronousLoad::DelayedReply>);
    7575    void loadPing(const NetworkResourceLoadParameters&);
     76    void prefetchDNS(const String&);
    7677
    7778    void removeLoadIdentifier(ResourceLoadIdentifier);
  • trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in

    r186530 r188331  
    3030    RemoveLoadIdentifier(uint64_t resourceLoadIdentifier)
    3131    SetDefersLoading(uint64_t resourceLoadIdentifier, bool defers)
     32    PrefetchDNS(String hostname)
    3233
    3334    StartDownload(WebCore::SessionID sessionID, uint64_t downloadID, WebCore::ResourceRequest request)
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/API/gtk/WebKitWebExtension.cpp

    r185502 r188331  
    2828#include "WebKitWebExtensionPrivate.h"
    2929#include "WebKitWebPagePrivate.h"
    30 #include <WebCore/DNS.h>
     30#include "WebProcess.h"
    3131#include <wtf/HashMap.h>
    3232#include <wtf/glib/GRefPtr.h>
     
    162162    if (messageName == String::fromUTF8("PrefetchDNS")) {
    163163        API::String* hostname = static_cast<API::String*>(message.get(String::fromUTF8("Hostname")));
    164         WebCore::prefetchDNS(hostname->string());
     164        WebProcess::singleton().prefetchDNS(hostname->string());
    165165    } else
    166166        ASSERT_NOT_REACHED();
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r188287 r188331  
    17121712#endif
    17131713
     1714void WebFrameLoaderClient::prefetchDNS(const String& hostname)
     1715{
     1716    WebProcess::singleton().prefetchDNS(hostname);
     1717}
     1718
    17141719} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.h

    r187002 r188331  
    242242#endif
    243243
     244    void prefetchDNS(const String&) override;
     245
    244246    WebFrame* m_frame;
    245247    RefPtr<PluginView> m_pluginView;
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r187522 r188331  
    5151#import <CoreText/CTFont.h>
    5252#import <WebCore/Chrome.h>
    53 #import <WebCore/DNS.h>
    5453#import <WebCore/DiagnosticLoggingClient.h>
    5554#import <WebCore/DiagnosticLoggingKeys.h>
     
    6059#import <WebCore/FocusController.h>
    6160#import <WebCore/Frame.h>
     61#import <WebCore/FrameLoaderClient.h>
    6262#import <WebCore/FrameView.h>
    6363#import <WebCore/GeometryUtilities.h>
     
    630630
    631631    if (is<Element>(*node))
    632         prefetchDNS(downcast<Element>(*node).absoluteLinkURL().host());
     632        m_page->mainFrame().loader().client().prefetchDNS(downcast<Element>(*node).absoluteLinkURL().host());
    633633
    634634    Vector<FloatQuad> quads;
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r187544 r188331  
    3737#include "InjectedBundle.h"
    3838#include "Logging.h"
     39#include "NetworkConnectionToWebProcessMessages.h"
    3940#include "PluginProcessConnectionManager.h"
    4041#include "SessionTracker.h"
     
    6869#include <WebCore/AuthenticationChallenge.h>
    6970#include <WebCore/CrossOriginPreflightResultCache.h>
     71#include <WebCore/DNS.h>
    7072#include <WebCore/FontCache.h>
    7173#include <WebCore/FontCascade.h>
     
    14521454#endif
    14531455
     1456void WebProcess::prefetchDNS(const String& hostname)
     1457{
     1458    if (!usesNetworkProcess()) {
     1459        WebCore::prefetchDNS(hostname);
     1460        return;
     1461    }
     1462
     1463#if ENABLE(NETWORK_PROCESS)
     1464    networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::PrefetchDNS(hostname), 0);
     1465#endif
     1466}
     1467
    14541468} // namespace WebKit
  • trunk/Source/WebKit2/WebProcess/WebProcess.h

    r186140 r188331  
    215215#endif
    216216
     217    void prefetchDNS(const String&);
     218
    217219private:
    218220    WebProcess();
Note: See TracChangeset for help on using the changeset viewer.