Commit 59f4f955 authored by Ryan Sturm's avatar Ryan Sturm Committed by Chromium LUCI CQ

Setting search prefetch priority to MEDIUM/HIGHEST

When the prefetch request starts, we will use MEDIUM priority, when it
is being served, we will convert it to HIGHEST prioirty (derived from
navigation resource request).

Bug: 11567701
Change-Id: I388336e972675ea72504135c0022c9b56aa3a99c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2580447
Commit-Queue: Ryan Sturm <ryansturm@chromium.org>
Reviewed-by: default avatarTarun Bansal <tbansal@chromium.org>
Cr-Commit-Position: refs/heads/master@{#834978}
parent f19e574f
...@@ -126,6 +126,10 @@ bool BaseSearchPrefetchRequest::StartPrefetchRequest(Profile* profile) { ...@@ -126,6 +126,10 @@ bool BaseSearchPrefetchRequest::StartPrefetchRequest(Profile* profile) {
url::Origin prefetch_origin = url::Origin::Create(prefetch_url_); url::Origin prefetch_origin = url::Origin::Create(prefetch_url_);
auto resource_request = std::make_unique<network::ResourceRequest>(); auto resource_request = std::make_unique<network::ResourceRequest>();
// This prefetch is not as high priority as navigation, but due to its
// navigation speeding and relatively high likelihood of being served to a
// navigation, the request is relatively high priority.
resource_request->priority = net::MEDIUM;
resource_request->load_flags |= net::LOAD_PREFETCH; resource_request->load_flags |= net::LOAD_PREFETCH;
resource_request->url = prefetch_url_; resource_request->url = prefetch_url_;
// Search prefetch URL Loaders should check |report_raw_headers| on the // Search prefetch URL Loaders should check |report_raw_headers| on the
......
...@@ -64,6 +64,9 @@ void StreamingSearchPrefetchURLLoader::SetUpForwardingClient( ...@@ -64,6 +64,9 @@ void StreamingSearchPrefetchURLLoader::SetUpForwardingClient(
DCHECK(!streaming_prefetch_request_); DCHECK(!streaming_prefetch_request_);
// Bind to the content/ navigation code. // Bind to the content/ navigation code.
DCHECK(!receiver_.is_bound()); DCHECK(!receiver_.is_bound());
network_url_loader_->SetPriority(resource_request.priority, -1);
receiver_.Bind(std::move(receiver)); receiver_.Bind(std::move(receiver));
receiver_.set_disconnect_handler( receiver_.set_disconnect_handler(
base::BindOnce(&StreamingSearchPrefetchURLLoader::OnMojoDisconnect, base::BindOnce(&StreamingSearchPrefetchURLLoader::OnMojoDisconnect,
......
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