Commit 23e7d383 authored by rajendrant's avatar rajendrant Committed by Commit Bot

Move PreviewsResourceLoadingHints mojo out of blink

Moves the PreviewsResourceLoadingHints interface away from blink, since
its not used in blink. This also refactors the subresource redirect
interface out of PreviewsResourceLoadingHints.

Bug: 1152527
TBR: dom@chromium.org
Change-Id: Id3036c3ef91240cb9fb986f06cf478780e18492c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2556566
Commit-Queue: rajendrant <rajendrant@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarRobert Ogden <robertogden@chromium.org>
Cr-Commit-Position: refs/heads/master@{#831162}
parent fba47e51
......@@ -20,6 +20,7 @@
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h"
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/previews_resource_loading_hints.mojom.h"
#include "components/optimization_guide/optimization_guide_decider.h"
#include "components/optimization_guide/proto/lite_video_metadata.pb.h"
#include "content/public/browser/navigation_handle.h"
......@@ -33,7 +34,6 @@
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom.h"
namespace {
......@@ -183,10 +183,10 @@ void LiteVideoObserver::SendHintToRenderFrameAgentForID(
if (!render_frame_host)
return;
mojo::AssociatedRemote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
mojo::AssociatedRemote<previews::mojom::PreviewsResourceLoadingHintsReceiver>
loading_hints_agent;
auto hint_ptr = blink::mojom::LiteVideoHint::New();
auto hint_ptr = previews::mojom::LiteVideoHint::New();
hint_ptr->target_downlink_bandwidth_kbps =
hint.target_downlink_bandwidth_kbps();
hint_ptr->kilobytes_to_buffer_before_throttle =
......@@ -249,7 +249,7 @@ void LiteVideoObserver::MediaBufferUnderflow(const content::MediaPlayerId& id) {
return;
}
mojo::AssociatedRemote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
mojo::AssociatedRemote<previews::mojom::PreviewsResourceLoadingHintsReceiver>
loading_hints_agent;
if (!render_frame_host->GetRemoteAssociatedInterfaces())
......@@ -291,7 +291,7 @@ void LiteVideoObserver::MediaPlayerSeek(const content::MediaPlayerId& id) {
return;
}
mojo::AssociatedRemote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
mojo::AssociatedRemote<previews::mojom::PreviewsResourceLoadingHintsReceiver>
loading_hints_agent;
if (!render_frame_host->GetRemoteAssociatedInterfaces())
......
......@@ -12,11 +12,11 @@
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service.h"
#include "chrome/browser/optimization_guide/optimization_guide_keyed_service_factory.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/previews_resource_loading_hints.mojom.h"
#include "components/optimization_guide/proto/hints.pb.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_handle.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom.h"
namespace optimization_guide {
......@@ -60,7 +60,7 @@ void BlinkOptimizationGuideWebContentsObserver::ReadyToCommitNavigation(
// Tentatively use the Previews interface to talk with the renderer.
// TODO(https://crbug.com/1113980): Implement our own interface.
mojo::AssociatedRemote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
mojo::AssociatedRemote<previews::mojom::PreviewsResourceLoadingHintsReceiver>
hints_receiver_associated;
if (navigation_handle->GetRenderFrameHost()
->GetRemoteAssociatedInterfaces()) {
......
......@@ -14,6 +14,7 @@
#include "chrome/browser/previews/previews_service_factory.h"
#include "chrome/browser/previews/previews_ui_tab_helper.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/common/previews_resource_loading_hints.mojom.h"
#include "components/previews/content/previews_ui_service.h"
#include "components/previews/content/previews_user_data.h"
#include "components/previews/core/previews_experiments.h"
......@@ -26,7 +27,6 @@
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom.h"
#include "url/gurl.h"
ResourceLoadingHintsWebContentsObserver::
......@@ -95,11 +95,11 @@ void ResourceLoadingHintsWebContentsObserver::SendResourceLoadingHints(
bool is_redirect = previews_user_data->is_redirect();
mojo::Remote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
mojo::Remote<previews::mojom::PreviewsResourceLoadingHintsReceiver>
hints_receiver;
blink::mojom::PreviewsResourceLoadingHintsPtr hints_ptr =
blink::mojom::PreviewsResourceLoadingHints::New();
previews::mojom::PreviewsResourceLoadingHintsPtr hints_ptr =
previews::mojom::PreviewsResourceLoadingHints::New();
const std::vector<std::string>& hints =
GetResourceLoadingHintsResourcePatternsToBlock(
......@@ -144,10 +144,10 @@ const std::vector<std::string> ResourceLoadingHintsWebContentsObserver::
return resource_patterns_to_block;
}
mojo::AssociatedRemote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
mojo::AssociatedRemote<previews::mojom::PreviewsResourceLoadingHintsReceiver>
ResourceLoadingHintsWebContentsObserver::GetResourceLoadingHintsReceiver(
content::NavigationHandle* navigation_handle) {
mojo::AssociatedRemote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
mojo::AssociatedRemote<previews::mojom::PreviewsResourceLoadingHintsReceiver>
loading_hints_agent;
if (navigation_handle->GetRenderFrameHost()
......
......@@ -9,12 +9,12 @@
#include <vector>
#include "base/macros.h"
#include "chrome/common/previews_resource_loading_hints.mojom-forward.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom-forward.h"
class Profile;
......@@ -71,7 +71,7 @@ class ResourceLoadingHintsWebContentsObserver
// Set in constructor.
Profile* profile_ = nullptr;
mojo::AssociatedRemote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
mojo::AssociatedRemote<previews::mojom::PreviewsResourceLoadingHintsReceiver>
GetResourceLoadingHintsReceiver(content::NavigationHandle* navigation_handle);
WEB_CONTENTS_USER_DATA_KEY_DECL();
......
......@@ -16,7 +16,6 @@
#include "content/public/browser/web_contents.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom.h"
#include "url/gurl.h"
namespace subresource_redirect {
......@@ -45,14 +44,14 @@ GetOptimizationGuideDeciderFromWebContents(content::WebContents* web_contents) {
// Pass down the |images_hints| to |render_frame_host|.
void SetResourceLoadingImageHints(
content::RenderFrameHost* render_frame_host,
blink::mojom::CompressPublicImagesHintsPtr images_hints) {
mojo::AssociatedRemote<blink::mojom::PreviewsResourceLoadingHintsReceiver>
loading_hints_agent;
mojom::CompressPublicImagesHintsPtr images_hints) {
mojo::AssociatedRemote<mojom::SubresourceRedirectHintsReceiver>
hints_receiver;
if (render_frame_host->GetRemoteAssociatedInterfaces()) {
render_frame_host->GetRemoteAssociatedInterfaces()->GetInterface(
&loading_hints_agent);
loading_hints_agent->SetCompressPublicImagesHints(std::move(images_hints));
&hints_receiver);
hints_receiver->SetCompressPublicImagesHints(std::move(images_hints));
}
}
......@@ -166,7 +165,7 @@ void SubresourceRedirectObserver::OnResourceLoadingImageHintsReceived(
// purposes.
SetResourceLoadingImageHints(
current_render_frame_host,
blink::mojom::CompressPublicImagesHints::New(public_image_urls));
mojom::CompressPublicImagesHints::New(public_image_urls));
if (!public_image_urls.empty())
is_https_image_compression_applied_ = true;
}
......
......@@ -714,6 +714,7 @@ mojom("mojo_bindings") {
"network_easter_egg.mojom",
"open_search_description_document_handler.mojom",
"plugin.mojom",
"previews_resource_loading_hints.mojom",
"renderer_configuration.mojom",
"subresource_redirect_service.mojom",
"sync_encryption_keys_extension.mojom",
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
module blink.mojom;
module previews.mojom;
import "mojo/public/mojom/base/time.mojom";
import "third_party/blink/public/mojom/optimization_guide/optimization_guide.mojom";
......@@ -22,13 +22,6 @@ struct PreviewsResourceLoadingHints {
array<string> subresources_to_block;
};
// Image loading hints passed by the browser to renderers. Send at most once
// per page load from browser to renderer. The hints are provided to the
// renderer and aid in redirecting these public images to compressed versions.
struct CompressPublicImagesHints {
array<string> image_urls;
};
// LiteVideo hints passed by the browser to renderers. Send at most once
// per render frame from browser to renderer. The hints are provided to the
// renderer and aid in optimizing media data use.
......@@ -52,16 +45,13 @@ interface PreviewsResourceLoadingHintsReceiver {
// Sends the resource loading hints from the browser to renderers.
SetResourceLoadingHints(PreviewsResourceLoadingHints previews_resource_loading_hints);
// Sends the public image URL hints from the browser to renderers.
SetCompressPublicImagesHints(CompressPublicImagesHints images_hints);
// Sends the hints for reducing the data-costs of streaming
// media/videos from the browser to renderers.
SetLiteVideoHint(LiteVideoHint lite_video_hint);
// Sends the hints for Blink.
// TODO(https://crbug.com/1113980): Move this to its own mojo plumbing.
SetBlinkOptimizationGuideHints(BlinkOptimizationGuideHints hints);
SetBlinkOptimizationGuideHints(blink.mojom.BlinkOptimizationGuideHints hints);
// Notifies the renderers that active media request throttles should be stopped
// and not allow any new throttles.
......
......@@ -6,6 +6,13 @@ module subresource_redirect.mojom;
import "mojo/public/mojom/base/time.mojom";
// Image loading hints passed by the browser to renderers. Send at most once
// per page load from browser to renderer. The hints are provided to the
// renderer and aid in redirecting these public images to compressed versions.
struct CompressPublicImagesHints {
array<string> image_urls;
};
// This service is implemented in the browser process and is used by the
// renderer to notify the state of https image compression. This interface is
// associated with a frame.
......@@ -16,3 +23,10 @@ interface SubresourceRedirectService {
// |retry_after| is zero.
NotifyCompressedImageFetchFailed(mojo_base.mojom.TimeDelta retry_after);
};
// Render process implemented interface that receives hints from the browser
// about https image compression.
interface SubresourceRedirectHintsReceiver {
// Sends the public image URL hints from the browser to renderers.
SetCompressPublicImagesHints(CompressPublicImagesHints images_hints);
};
......@@ -607,7 +607,8 @@ void ChromeContentRendererClient::RenderFrameCreated(
new previews::ResourceLoadingHintsAgent(associated_interfaces, render_frame);
if (subresource_redirect::IsPublicImageHintsBasedCompressionEnabled())
new subresource_redirect::SubresourceRedirectHintsAgent(render_frame);
new subresource_redirect::SubresourceRedirectHintsAgent(
associated_interfaces, render_frame);
if (translate::IsSubFrameTranslationEnabled()) {
new translate::PerFrameTranslateAgent(
......
......@@ -86,7 +86,7 @@ bool LiteVideoHintAgent::HasLiteVideoHint() const {
}
void LiteVideoHintAgent::SetLiteVideoHint(
blink::mojom::LiteVideoHintPtr lite_video_hint) {
previews::mojom::LiteVideoHintPtr lite_video_hint) {
if (!lite_video_hint)
return;
target_downlink_bandwidth_kbps_ =
......
......@@ -7,10 +7,10 @@
#include "base/macros.h"
#include "base/time/time.h"
#include "chrome/common/previews_resource_loading_hints.mojom.h"
#include "chrome/renderer/lite_video/lite_video_url_loader_throttle.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_observer_tracker.h"
#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom.h"
#include "url/gurl.h"
namespace lite_video {
......@@ -40,7 +40,7 @@ class LiteVideoHintAgent
// Updates the LiteVideo throttling parameters for calculating
// the latency to add to media requests.
void SetLiteVideoHint(blink::mojom::LiteVideoHintPtr lite_video_hint);
void SetLiteVideoHint(previews::mojom::LiteVideoHintPtr lite_video_hint);
// Returns whether |this| has been provided a LiteVideoHint and
// has the parameters needed for calculating the throttling latency.
......
......@@ -135,7 +135,8 @@ class LiteVideoHintAgentTest : public ChromeRenderViewTest {
new LiteVideoHintAgent(view_->GetMainRenderFrame());
// Set some default hints.
blink::mojom::LiteVideoHintPtr hint = blink::mojom::LiteVideoHint::New();
previews::mojom::LiteVideoHintPtr hint =
previews::mojom::LiteVideoHint::New();
hint->kilobytes_to_buffer_before_throttle = 10;
hint->target_downlink_bandwidth_kbps = 60;
hint->target_downlink_rtt_latency = base::TimeDelta::FromMilliseconds(500);
......
......@@ -103,7 +103,7 @@ ResourceLoadingHintsAgent::~ResourceLoadingHintsAgent() = default;
void ResourceLoadingHintsAgent::SetReceiver(
mojo::PendingAssociatedReceiver<
blink::mojom::PreviewsResourceLoadingHintsReceiver> receiver) {
previews::mojom::PreviewsResourceLoadingHintsReceiver> receiver) {
receiver_.Bind(std::move(receiver));
}
......@@ -112,7 +112,7 @@ bool ResourceLoadingHintsAgent::IsMainFrame() const {
}
void ResourceLoadingHintsAgent::SetResourceLoadingHints(
blink::mojom::PreviewsResourceLoadingHintsPtr resource_loading_hints) {
previews::mojom::PreviewsResourceLoadingHintsPtr resource_loading_hints) {
if (!IsMainFrame())
return;
......@@ -124,18 +124,8 @@ void ResourceLoadingHintsAgent::SetResourceLoadingHints(
}
}
void ResourceLoadingHintsAgent::SetCompressPublicImagesHints(
blink::mojom::CompressPublicImagesHintsPtr images_hints) {
if (auto* subresource_redirect_hints_agent =
subresource_redirect::SubresourceRedirectHintsAgent::Get(
render_frame())) {
subresource_redirect_hints_agent->SetCompressPublicImagesHints(
std::move(images_hints));
}
}
void ResourceLoadingHintsAgent::SetLiteVideoHint(
blink::mojom::LiteVideoHintPtr lite_video_hint) {
previews::mojom::LiteVideoHintPtr lite_video_hint) {
auto* lite_video_hint_agent =
lite_video::LiteVideoHintAgent::Get(render_frame());
if (lite_video_hint_agent)
......
......@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/macros.h"
#include "base/optional.h"
#include "chrome/common/previews_resource_loading_hints.mojom.h"
#include "chrome/renderer/lite_video/lite_video_hint_agent.h"
#include "content/public/renderer/render_frame_observer.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
......@@ -17,7 +18,6 @@
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom.h"
#include "url/gurl.h"
namespace previews {
......@@ -27,7 +27,7 @@ namespace previews {
// the document loader.
class ResourceLoadingHintsAgent
: public content::RenderFrameObserver,
public blink::mojom::PreviewsResourceLoadingHintsReceiver,
public previews::mojom::PreviewsResourceLoadingHintsReceiver,
public base::SupportsWeakPtr<ResourceLoadingHintsAgent> {
public:
ResourceLoadingHintsAgent(
......@@ -42,27 +42,26 @@ class ResourceLoadingHintsAgent
GURL GetDocumentURL() const;
// blink::mojom::PreviewsResourceLoadingHintsReceiver:
void SetResourceLoadingHints(blink::mojom::PreviewsResourceLoadingHintsPtr
// previews::mojom::PreviewsResourceLoadingHintsReceiver:
void SetResourceLoadingHints(previews::mojom::PreviewsResourceLoadingHintsPtr
resource_loading_hints) override;
void SetCompressPublicImagesHints(
blink::mojom::CompressPublicImagesHintsPtr images_hints) override;
void SetLiteVideoHint(
blink::mojom::LiteVideoHintPtr lite_video_hint) override;
previews::mojom::LiteVideoHintPtr lite_video_hint) override;
void SetBlinkOptimizationGuideHints(
blink::mojom::BlinkOptimizationGuideHintsPtr hints) override;
void StopThrottlingMediaRequests() override;
void SetReceiver(
mojo::PendingAssociatedReceiver<
blink::mojom::PreviewsResourceLoadingHintsReceiver> receiver);
previews::mojom::PreviewsResourceLoadingHintsReceiver> receiver);
bool IsMainFrame() const;
std::vector<std::string> subresource_patterns_to_block_;
base::Optional<int64_t> ukm_source_id_;
mojo::AssociatedReceiver<blink::mojom::PreviewsResourceLoadingHintsReceiver>
mojo::AssociatedReceiver<
previews::mojom::PreviewsResourceLoadingHintsReceiver>
receiver_{this};
blink::mojom::BlinkOptimizationGuideHintsPtr blink_optimization_guide_hints_;
......
......@@ -39,7 +39,7 @@ class SubresourceRedirectPublicImageHintsURLLoaderThrottleTest
void SetCompressPublicImagesHints(
const std::vector<std::string>& public_image_urls) {
subresource_redirect_hints_agent_->SetCompressPublicImagesHints(
blink::mojom::CompressPublicImagesHints::New(public_image_urls));
mojom::CompressPublicImagesHints::New(public_image_urls));
}
std::unique_ptr<PublicImageHintsURLLoaderThrottle>
......@@ -67,8 +67,8 @@ class SubresourceRedirectPublicImageHintsURLLoaderThrottleTest
{{blink::features::kSubresourceRedirect,
{{"enable_subresource_server_redirect", "true"}}}},
{});
subresource_redirect_hints_agent_ =
new SubresourceRedirectHintsAgent(view_->GetMainRenderFrame());
subresource_redirect_hints_agent_ = new SubresourceRedirectHintsAgent(
&associated_interfaces_, view_->GetMainRenderFrame());
}
private:
......
......@@ -17,12 +17,18 @@
namespace subresource_redirect {
SubresourceRedirectHintsAgent::SubresourceRedirectHintsAgent(
blink::AssociatedInterfaceRegistry* associated_interfaces,
content::RenderFrame* render_frame)
: content::RenderFrameObserver(render_frame),
content::RenderFrameObserverTracker<SubresourceRedirectHintsAgent>(
render_frame) {
DCHECK(render_frame);
DCHECK(IsPublicImageHintsBasedCompressionEnabled());
// base::Unretained is safe here because |this| is created for the RenderFrame
// never destroyed.
associated_interfaces->AddInterface(
base::BindRepeating(&SubresourceRedirectHintsAgent::BindHintsReceiver,
base::Unretained(this)));
}
SubresourceRedirectHintsAgent::~SubresourceRedirectHintsAgent() = default;
......@@ -60,7 +66,7 @@ void SubresourceRedirectHintsAgent::OnDestruct() {
}
void SubresourceRedirectHintsAgent::SetCompressPublicImagesHints(
blink::mojom::CompressPublicImagesHintsPtr images_hints) {
mojom::CompressPublicImagesHintsPtr images_hints) {
if (!IsMainFrame())
return;
DCHECK(public_image_urls_.empty());
......@@ -185,4 +191,10 @@ void SubresourceRedirectHintsAgent::NotifyHttpsImageCompressionFetchFailed(
ClearImageHints();
}
void SubresourceRedirectHintsAgent::BindHintsReceiver(
mojo::PendingAssociatedReceiver<mojom::SubresourceRedirectHintsReceiver>
receiver) {
subresource_redirect_hints_receiver_.Bind(std::move(receiver));
}
} // namespace subresource_redirect
......@@ -9,12 +9,14 @@
#include "base/macros.h"
#include "base/optional.h"
#include "base/timer/timer.h"
#include "chrome/common/previews_resource_loading_hints.mojom.h"
#include "chrome/common/subresource_redirect_service.mojom.h"
#include "content/public/renderer/render_frame_observer.h"
#include "content/public/renderer/render_frame_observer_tracker.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom.h"
#include "url/gurl.h"
namespace subresource_redirect {
......@@ -23,6 +25,7 @@ namespace subresource_redirect {
// redirects public images for mainframes.
class SubresourceRedirectHintsAgent
: public content::RenderFrameObserver,
public mojom::SubresourceRedirectHintsReceiver,
public content::RenderFrameObserverTracker<
SubresourceRedirectHintsAgent> {
public:
......@@ -55,13 +58,19 @@ class SubresourceRedirectHintsAgent
kIneligibleOtherImage
};
explicit SubresourceRedirectHintsAgent(content::RenderFrame* render_frame);
explicit SubresourceRedirectHintsAgent(
blink::AssociatedInterfaceRegistry* associated_interfaces,
content::RenderFrame* render_frame);
~SubresourceRedirectHintsAgent() override;
SubresourceRedirectHintsAgent(const SubresourceRedirectHintsAgent&) = delete;
SubresourceRedirectHintsAgent& operator=(
const SubresourceRedirectHintsAgent&) = delete;
// mojom::SubresourceRedirectHintsReceiver:
void SetCompressPublicImagesHints(
mojom::CompressPublicImagesHintsPtr images_hints) override;
RedirectResult ShouldRedirectImage(const GURL& url) const;
// Record metrics when the resource load is finished.
......@@ -69,9 +78,6 @@ class SubresourceRedirectHintsAgent
int64_t content_length,
RedirectResult redirect_result);
void SetCompressPublicImagesHints(
blink::mojom::CompressPublicImagesHintsPtr images_hints);
// Notifies the browser process that https image compression fetch had failed.
void NotifyHttpsImageCompressionFetchFailed(base::TimeDelta retry_after);
......@@ -99,6 +105,11 @@ class SubresourceRedirectHintsAgent
// image was in the delayed hints.
void RecordImageHintsUnavailableMetrics();
// Binds the mojo hints receiver pipe.
void BindHintsReceiver(
mojo::PendingAssociatedReceiver<mojom::SubresourceRedirectHintsReceiver>
receiver);
bool public_image_urls_received_ = false;
base::flat_set<std::string> public_image_urls_;
......@@ -111,6 +122,9 @@ class SubresourceRedirectHintsAgent
// until hints are received or it times out and used to record metrics.
base::flat_set<std::pair<std::string, int64_t>> unavailable_image_hints_urls_;
mojo::AssociatedReceiver<mojom::SubresourceRedirectHintsReceiver>
subresource_redirect_hints_receiver_{this};
mojo::AssociatedRemote<
subresource_redirect::mojom::SubresourceRedirectService>
subresource_redirect_service_remote_;
......
......@@ -98,7 +98,6 @@ mojom("mojom_platform") {
"loader/fetch_client_settings_object.mojom",
"loader/navigation_predictor.mojom",
"loader/pause_subresource_loading_handle.mojom",
"loader/previews_resource_loading_hints.mojom",
"loader/referrer.mojom",
"loader/request_context_frame_type.mojom",
"loader/resource_load_info.mojom",
......
......@@ -38,7 +38,7 @@
#include "mojo/public/cpp/bindings/binder_map.h"
#include "third_party/blink/public/common/experiments/memory_ablation_experiment.h"
#include "third_party/blink/public/common/features.h"
#include "third_party/blink/public/mojom/loader/previews_resource_loading_hints.mojom-blink.h"
#include "third_party/blink/public/mojom/optimization_guide/optimization_guide.mojom-blink.h"
#include "third_party/blink/public/platform/interface_registry.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/web/blink.h"
......
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