Commit 7d218d58 authored by Kinuko Yasuda's avatar Kinuko Yasuda Committed by Commit Bot

Add a use counter for SXG prefetch

Change-Id: Ib180117dea189876c2e095a114277b6e2d1ba6eb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1935972
Commit-Queue: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: default avatarKunihiko Sakamoto <ksakamoto@chromium.org>
Reviewed-by: default avatarTsuyoshi Horo <horo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#719143}
parent df4a1a70
......@@ -2481,6 +2481,7 @@ enum WebFeature {
kV8PortalHost_PostMessage_Method = 3100,
kV8PortalActivateEvent_Data_AttributeGetter = 3101,
kV8PortalActivateEvent_AdoptPredecessor_Method = 3102,
kLinkRelPrefetchForSignedExchanges = 3103,
// Add new features immediately above this line. Don't change assigned
// numbers of any item, and don't reuse removed slots.
......
......@@ -145,19 +145,23 @@ void ResourceLoadObserverForFrame::DidReceiveResponse(
response.RemoteIPAddress());
std::unique_ptr<AlternateSignedExchangeResourceInfo> alternate_resource_info;
if (RuntimeEnabledFeatures::SignedExchangeSubresourcePrefetchEnabled(
&frame_or_imported_document_->GetDocument()) &&
response.IsSignedExchangeInnerResponse() &&
resource->GetType() == ResourceType::kLinkPrefetch &&
resource->LastResourceResponse()) {
// If this is a prefetch for a SXG, see if the outer response (which must be
// the last response in the redirect chain) had provided alternate links for
// the prefetch.
alternate_resource_info =
AlternateSignedExchangeResourceInfo::CreateIfValid(
resource->LastResourceResponse()->HttpHeaderField(
http_names::kLink),
response.HttpHeaderField(http_names::kLink));
// See if this is a prefetch for a SXG.
if (response.IsSignedExchangeInnerResponse() &&
resource->GetType() == ResourceType::kLinkPrefetch) {
CountUsage(WebFeature::kLinkRelPrefetchForSignedExchanges);
if (RuntimeEnabledFeatures::SignedExchangeSubresourcePrefetchEnabled(
&frame_or_imported_document_->GetDocument()) &&
resource->LastResourceResponse()) {
// See if the outer response (which must be the last response in
// the redirect chain) had provided alternate links for the prefetch.
alternate_resource_info =
AlternateSignedExchangeResourceInfo::CreateIfValid(
resource->LastResourceResponse()->HttpHeaderField(
http_names::kLink),
response.HttpHeaderField(http_names::kLink));
}
}
PreloadHelper::CanLoadResources resource_loading_policy =
......
......@@ -25590,6 +25590,7 @@ Called by update_net_error_codes.py.-->
<int value="3100" label="V8PortalHost_PostMessage_Method"/>
<int value="3101" label="V8PortalActivateEvent_Data_AttributeGetter"/>
<int value="3102" label="V8PortalActivateEvent_AdoptPredecessor_Method"/>
<int value="3103" label="LinkRelPrefetchForSignedExchanges"/>
</enum>
<enum name="FeaturePolicyAllowlistType">
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