Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: content/browser/frame_host/render_frame_host_impl.cc

Issue 2913253002: GRC: Hook up the frame-level CoordinationUnit (Closed)
Patch Set: Review fixes and rebase Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 4dff34ddfbb36f8cbab77c35cb1d6f3b5f9f2201..2b6c6a5ff179ef7cf107de92b041094edd24934e 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()->AddBinding(
+ std::move(request));
+}
+
template <typename Interface>
void IgnoreInterfaceRequest(const service_manager::BindSourceInfo& source_info,
mojo::InterfaceRequest<Interface> request) {
@@ -2837,6 +2846,9 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() {
base::Unretained(this)));
}
+ GetInterfaceRegistry()->AddInterface(base::Bind(
+ &CreateResourceCoordinatorFrameInterface, base::Unretained(this)));
+
#if BUILDFLAG(ENABLE_WEBRTC)
// BrowserMainLoop::GetInstance() may be null on unit tests.
if (BrowserMainLoop::GetInstance()) {
@@ -3261,6 +3273,8 @@ void RenderFrameHostImpl::InvalidateMojoConnection() {
// Disconnect with ImageDownloader Mojo service in RenderFrame.
mojo_image_downloader_.reset();
+
+ frame_resource_coordinator_.reset();
}
bool RenderFrameHostImpl::IsFocused() {
@@ -3367,6 +3381,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.
« no previous file with comments | « content/browser/frame_host/render_frame_host_impl.h ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698