Index: content/browser/frame_host/render_frame_host_impl.cc |
diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc |
index 64c719ca49b2d5c906fd33c22a2edd5a21ec2d69..152bbe31216741bf3a34a95a1b519a2218238365 100644 |
--- a/content/browser/frame_host/render_frame_host_impl.cc |
+++ b/content/browser/frame_host/render_frame_host_impl.cc |
@@ -244,6 +244,13 @@ void IgnoreInterfaceRequest(mojo::InterfaceRequest<Interface> request) { |
// Intentionally ignore the interface request. |
} |
+void CreateResourceCoordinatorFrameInterface( |
+ RenderFrameHostImpl* render_frame_host, |
+ resource_coordinator::mojom::CoordinationUnitRequest request) { |
+ render_frame_host->GetFrameResourceCoordinator()->service()->Duplicate( |
+ std::move(request)); |
+} |
+ |
} // namespace |
// static |
@@ -2349,6 +2356,9 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() { |
base::Bind(&IgnoreInterfaceRequest<device::mojom::VRService>)); |
#endif |
+ GetInterfaceRegistry()->AddInterface(base::Bind( |
+ &CreateResourceCoordinatorFrameInterface, base::Unretained(this))); |
+ |
if (base::FeatureList::IsEnabled(features::kGenericSensor)) { |
GetInterfaceRegistry()->AddInterface( |
base::Bind(&device::SensorProviderImpl::Create, |
@@ -2784,6 +2794,7 @@ void RenderFrameHostImpl::InvalidateMojoConnection() { |
// Disconnect with ImageDownloader Mojo service in RenderFrame. |
mojo_image_downloader_.reset(); |
+ frame_resource_coordinator_.reset(); |
} |
bool RenderFrameHostImpl::IsFocused() { |
@@ -2890,6 +2901,18 @@ RenderFrameHostImpl::GetMojoImageDownloader() { |
return mojo_image_downloader_; |
} |
+resource_coordinator::ResourceCoordinatorInterface* |
+RenderFrameHostImpl::GetFrameResourceCoordinator() { |
+ if (!frame_resource_coordinator_) { |
+ frame_resource_coordinator_ = |
+ base::MakeUnique<resource_coordinator::ResourceCoordinatorInterface>( |
+ ServiceManagerConnection::GetForProcess()->GetConnector(), |
+ resource_coordinator::mojom::IDType::FRAME); |
+ } |
+ |
+ return frame_resource_coordinator_.get(); |
+} |
+ |
void RenderFrameHostImpl::ResetLoadingState() { |
if (is_loading()) { |
// When pending deletion, just set the loading state to not loading. |