Chromium Code Reviews| 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 c5c6b04749a9de5743278470bc877171e85f9b35..b2675841463b46bb16f46d7771ade2bf56444e0d 100644 |
| --- a/content/browser/frame_host/render_frame_host_impl.cc |
| +++ b/content/browser/frame_host/render_frame_host_impl.cc |
| @@ -114,6 +114,7 @@ |
| #include "mojo/public/cpp/bindings/associated_interface_ptr.h" |
| #include "mojo/public/cpp/bindings/strong_binding.h" |
| #include "mojo/public/cpp/system/data_pipe.h" |
| +#include "services/resource_coordinator/public/cpp/resource_coordinator_interface.h" |
| #include "services/service_manager/public/cpp/connector.h" |
| #include "services/service_manager/public/cpp/interface_provider.h" |
| #include "third_party/WebKit/public/platform/WebFeaturePolicy.h" |
| @@ -266,6 +267,14 @@ class RemoterFactoryImpl final : public media::mojom::RemoterFactory { |
| }; |
| #endif // BUILDFLAG(ENABLE_MEDIA_REMOTING) |
| +void CreateResourceCoordinatorFrameInterface( |
| + RenderFrameHostImpl* render_frame_host, |
| + const service_manager::BindSourceInfo& source_info, |
| + resource_coordinator::mojom::CoordinationUnitRequest request) { |
| + render_frame_host->GetFrameResourceCoordinator()->service()->Duplicate( |
|
nasko
2017/06/02 23:29:16
This code looks strange as it is written. Creating
oystein (OOO til 10th of July)
2017/06/05 20:02:39
Renamed to AddBinding and added a comment to bette
|
| + std::move(request)); |
| +} |
| + |
| template <typename Interface> |
| void IgnoreInterfaceRequest(const service_manager::BindSourceInfo& source_info, |
| mojo::InterfaceRequest<Interface> request) { |
| @@ -2830,6 +2839,9 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() { |
| base::Bind(&IgnoreInterfaceRequest<device::mojom::VRService>)); |
| #endif |
| + GetInterfaceRegistry()->AddInterface(base::Bind( |
| + &CreateResourceCoordinatorFrameInterface, base::Unretained(this))); |
| + |
| #if BUILDFLAG(ENABLE_WEBRTC) |
| // BrowserMainLoop::GetInstance() may be null on unit tests. |
| if (BrowserMainLoop::GetInstance()) { |
| @@ -3254,6 +3266,8 @@ void RenderFrameHostImpl::InvalidateMojoConnection() { |
| // Disconnect with ImageDownloader Mojo service in RenderFrame. |
| mojo_image_downloader_.reset(); |
| + |
| + frame_resource_coordinator_.reset(); |
| } |
| bool RenderFrameHostImpl::IsFocused() { |
| @@ -3360,6 +3374,17 @@ 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::CoordinationUnitType::kFrame); |
| + } |
| + return frame_resource_coordinator_.get(); |
| +} |
| + |
| void RenderFrameHostImpl::ResetLoadingState() { |
| if (is_loading()) { |
| // When pending deletion, just set the loading state to not loading. |