Commit d0924d18 authored by Abhijeet Kandalkar's avatar Abhijeet Kandalkar Committed by Commit Bot

Move platform/network/network_hints.h to core/loader

network_hints.h is only used by core/loader. Hence this CL moves
network_hints.h to core/loader and port other dependent files to refer
to a new include path.

Bug: 933883
Change-Id: Iaf8847348f3f174afcdd5b34a99aa045ee3b0cad
Reviewed-on: https://chromium-review.googlesource.com/c/1484873
Commit-Queue: Abhijeet Kandalkar <abhijeet@igalia.com>
Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#635886}
parent 843054e2
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include "third_party/blink/renderer/core/layout/layout_box.h" #include "third_party/blink/renderer/core/layout/layout_box.h"
#include "third_party/blink/renderer/core/loader/frame_load_request.h" #include "third_party/blink/renderer/core/loader/frame_load_request.h"
#include "third_party/blink/renderer/core/loader/navigation_policy.h" #include "third_party/blink/renderer/core/loader/navigation_policy.h"
#include "third_party/blink/renderer/core/loader/network_hints_interface.h"
#include "third_party/blink/renderer/core/loader/ping_loader.h" #include "third_party/blink/renderer/core/loader/ping_loader.h"
#include "third_party/blink/renderer/core/origin_trials/origin_trials.h" #include "third_party/blink/renderer/core/origin_trials/origin_trials.h"
#include "third_party/blink/renderer/core/page/chrome_client.h" #include "third_party/blink/renderer/core/page/chrome_client.h"
...@@ -50,7 +51,6 @@ ...@@ -50,7 +51,6 @@
#include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h" #include "third_party/blink/renderer/core/trustedtypes/trusted_types_util.h"
#include "third_party/blink/renderer/core/trustedtypes/trusted_url.h" #include "third_party/blink/renderer/core/trustedtypes/trusted_url.h"
#include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h" #include "third_party/blink/renderer/platform/loader/fetch/resource_fetcher.h"
#include "third_party/blink/renderer/platform/network/network_hints.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/weborigin/security_policy.h" #include "third_party/blink/renderer/platform/weborigin/security_policy.h"
...@@ -234,8 +234,10 @@ void HTMLAnchorElement::ParseAttribute( ...@@ -234,8 +234,10 @@ void HTMLAnchorElement::ParseAttribute(
String parsed_url = StripLeadingAndTrailingHTMLSpaces(params.new_value); String parsed_url = StripLeadingAndTrailingHTMLSpaces(params.new_value);
if (GetDocument().IsDNSPrefetchEnabled()) { if (GetDocument().IsDNSPrefetchEnabled()) {
if (ProtocolIs(parsed_url, "http") || ProtocolIs(parsed_url, "https") || if (ProtocolIs(parsed_url, "http") || ProtocolIs(parsed_url, "https") ||
parsed_url.StartsWith("//")) parsed_url.StartsWith("//")) {
PrefetchDNS(GetDocument().CompleteURL(parsed_url).Host()); NetworkHintsInterfaceImpl().DnsPrefetchHost(
GetDocument().CompleteURL(parsed_url).Host());
}
} }
} }
InvalidateCachedVisitedLinkHash(); InvalidateCachedVisitedLinkHash();
......
...@@ -87,6 +87,7 @@ blink_core_sources("loader") { ...@@ -87,6 +87,7 @@ blink_core_sources("loader") {
"navigation_policy.h", "navigation_policy.h",
"navigation_scheduler.cc", "navigation_scheduler.cc",
"navigation_scheduler.h", "navigation_scheduler.h",
"network_hints_interface.cc",
"network_hints_interface.h", "network_hints_interface.h",
"ping_loader.cc", "ping_loader.cc",
"ping_loader.h", "ping_loader.h",
......
...@@ -24,20 +24,22 @@ ...@@ -24,20 +24,22 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/ */
#include "third_party/blink/renderer/platform/network/network_hints.h" #include "third_party/blink/renderer/core/loader/network_hints_interface.h"
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/web_prescient_networking.h" #include "third_party/blink/public/platform/web_prescient_networking.h"
namespace blink { namespace blink {
void PrefetchDNS(const String& hostname) { void NetworkHintsInterfaceImpl::DnsPrefetchHost(const String& hostname) const {
if (WebPrescientNetworking* prescient_networking = if (WebPrescientNetworking* prescient_networking =
Platform::Current()->PrescientNetworking()) Platform::Current()->PrescientNetworking())
prescient_networking->PrefetchDNS(hostname); prescient_networking->PrefetchDNS(hostname);
} }
void Preconnect(const KURL& url, const CrossOriginAttributeValue cross_origin) { void NetworkHintsInterfaceImpl::PreconnectHost(
const KURL& url,
const CrossOriginAttributeValue cross_origin) const {
if (WebPrescientNetworking* prescient_networking = if (WebPrescientNetworking* prescient_networking =
Platform::Current()->PrescientNetworking()) { Platform::Current()->PrescientNetworking()) {
bool allow_credentials = (cross_origin != kCrossOriginAttributeAnonymous); bool allow_credentials = (cross_origin != kCrossOriginAttributeAnonymous);
......
...@@ -5,7 +5,8 @@ ...@@ -5,7 +5,8 @@
#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_NETWORK_HINTS_INTERFACE_H_ #ifndef THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_NETWORK_HINTS_INTERFACE_H_
#define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_NETWORK_HINTS_INTERFACE_H_ #define THIRD_PARTY_BLINK_RENDERER_CORE_LOADER_NETWORK_HINTS_INTERFACE_H_
#include "third_party/blink/renderer/platform/network/network_hints.h" #include "third_party/blink/renderer/platform/loader/fetch/cross_origin_attribute_value.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
namespace blink { namespace blink {
...@@ -17,13 +18,12 @@ class NetworkHintsInterface { ...@@ -17,13 +18,12 @@ class NetworkHintsInterface {
}; };
class NetworkHintsInterfaceImpl : public NetworkHintsInterface { class NetworkHintsInterfaceImpl : public NetworkHintsInterface {
void DnsPrefetchHost(const String& host) const override { PrefetchDNS(host); } public:
void DnsPrefetchHost(const String& host) const override;
void PreconnectHost( void PreconnectHost(
const KURL& host, const KURL& host,
const CrossOriginAttributeValue cross_origin) const override { const CrossOriginAttributeValue cross_origin) const override;
Preconnect(host, cross_origin);
}
}; };
} // namespace blink } // namespace blink
......
...@@ -30,12 +30,12 @@ ...@@ -30,12 +30,12 @@
#include "third_party/blink/renderer/core/frame/local_frame.h" #include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/inspector/console_message.h" #include "third_party/blink/renderer/core/inspector/console_message.h"
#include "third_party/blink/renderer/core/layout/hit_test_result.h" #include "third_party/blink/renderer/core/layout/hit_test_result.h"
#include "third_party/blink/renderer/core/loader/network_hints_interface.h"
#include "third_party/blink/renderer/core/page/frame_tree.h" #include "third_party/blink/renderer/core/page/frame_tree.h"
#include "third_party/blink/renderer/core/page/page.h" #include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/page/scoped_page_pauser.h" #include "third_party/blink/renderer/core/page/scoped_page_pauser.h"
#include "third_party/blink/renderer/core/probe/core_probes.h" #include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/geometry/int_rect.h" #include "third_party/blink/renderer/platform/geometry/int_rect.h"
#include "third_party/blink/renderer/platform/network/network_hints.h"
namespace blink { namespace blink {
...@@ -183,8 +183,10 @@ void ChromeClient::MouseDidMoveOverElement(LocalFrame& frame, ...@@ -183,8 +183,10 @@ void ChromeClient::MouseDidMoveOverElement(LocalFrame& frame,
const HitTestLocation& location, const HitTestLocation& location,
const HitTestResult& result) { const HitTestResult& result) {
if (!result.GetScrollbar() && result.InnerNode() && if (!result.GetScrollbar() && result.InnerNode() &&
result.InnerNode()->GetDocument().IsDNSPrefetchEnabled()) result.InnerNode()->GetDocument().IsDNSPrefetchEnabled()) {
PrefetchDNS(result.AbsoluteLinkURL().Host()); NetworkHintsInterfaceImpl().DnsPrefetchHost(
result.AbsoluteLinkURL().Host());
}
ShowMouseOverURL(result); ShowMouseOverURL(result);
......
...@@ -47,8 +47,6 @@ blink_platform_sources("network") { ...@@ -47,8 +47,6 @@ blink_platform_sources("network") {
"mime/mime_type_from_url.h", "mime/mime_type_from_url.h",
"mime/mime_type_registry.cc", "mime/mime_type_registry.cc",
"mime/mime_type_registry.h", "mime/mime_type_registry.h",
"network_hints.cc",
"network_hints.h",
"network_log.h", "network_log.h",
"network_state_notifier.cc", "network_state_notifier.cc",
"network_state_notifier.h", "network_state_notifier.h",
......
/*
* Copyright (C) 2008 Collin Jackson <collinj@webkit.org>
* Copyright (C) 2013 Google Inc. All rights reserved.
*
* 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.
*/
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_NETWORK_NETWORK_HINTS_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_NETWORK_NETWORK_HINTS_H_
#include "third_party/blink/renderer/platform/loader/fetch/cross_origin_attribute_value.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/weborigin/kurl.h"
#include "third_party/blink/renderer/platform/wtf/forward.h"
namespace blink {
PLATFORM_EXPORT void PrefetchDNS(const String& hostname);
PLATFORM_EXPORT void Preconnect(const KURL&, const CrossOriginAttributeValue);
} // namespace blink
#endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment