Commit 0e38e91b authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert QuotaDispatcherHost client to use BrowserInterfaceBroker

This change converts QuotaDispatcherHost mojom interface client in
blink to use BrowserInterfaceBroker.

Bug: 936482
Change-Id: Ib4879ab100af2aaf69ee763cf2767fdd50ec2f3a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824731Reviewed-by: default avatarOksana Zhuravlova <oksamyt@chromium.org>
Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#721301}
parent 2b2ea3c0
...@@ -82,7 +82,6 @@ ...@@ -82,7 +82,6 @@
#include "content/browser/portal/portal.h" #include "content/browser/portal/portal.h"
#include "content/browser/presentation/presentation_service_impl.h" #include "content/browser/presentation/presentation_service_impl.h"
#include "content/browser/push_messaging/push_messaging_manager.h" #include "content/browser/push_messaging/push_messaging_manager.h"
#include "content/browser/quota_dispatcher_host.h"
#include "content/browser/renderer_host/dip_util.h" #include "content/browser/renderer_host/dip_util.h"
#include "content/browser/renderer_host/input/input_router.h" #include "content/browser/renderer_host/input/input_router.h"
#include "content/browser/renderer_host/input/timeout_monitor.h" #include "content/browser/renderer_host/input/timeout_monitor.h"
...@@ -4660,10 +4659,6 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() { ...@@ -4660,10 +4659,6 @@ void RenderFrameHostImpl::RegisterMojoInterfaces() {
base::BindRepeating(&RenderFrameHostImpl::CreateAudioOutputStreamFactory, base::BindRepeating(&RenderFrameHostImpl::CreateAudioOutputStreamFactory,
base::Unretained(this))); base::Unretained(this)));
// TODO(crbug.com/775792): Move to RendererInterfaceBinders.
registry_->AddInterface(base::BindRepeating(
&QuotaDispatcherHost::CreateForFrame, GetProcess(), routing_id_));
file_system_manager_.reset(new FileSystemManagerImpl( file_system_manager_.reset(new FileSystemManagerImpl(
GetProcess()->GetID(), GetProcess()->GetID(),
GetProcess()->GetStoragePartition()->GetFileSystemContext(), GetProcess()->GetStoragePartition()->GetFileSystemContext(),
...@@ -6638,8 +6633,7 @@ void RenderFrameHostImpl::GetInterface( ...@@ -6638,8 +6633,7 @@ void RenderFrameHostImpl::GetInterface(
if (!registry_ || if (!registry_ ||
!registry_->TryBindInterface(interface_name, &interface_pipe)) { !registry_->TryBindInterface(interface_name, &interface_pipe)) {
delegate_->OnInterfaceRequest(this, interface_name, &interface_pipe); delegate_->OnInterfaceRequest(this, interface_name, &interface_pipe);
if (interface_pipe.is_valid() && if (interface_pipe.is_valid()) {
!TryBindFrameInterface(interface_name, &interface_pipe, this)) {
GetContentClient()->browser()->BindInterfaceRequestFromFrame( GetContentClient()->browser()->BindInterfaceRequestFromFrame(
this, interface_name, std::move(interface_pipe)); this, interface_name, std::move(interface_pipe));
} }
......
...@@ -29,9 +29,8 @@ using storage::QuotaManager; ...@@ -29,9 +29,8 @@ using storage::QuotaManager;
namespace content { namespace content {
namespace { // static
void QuotaDispatcherHost::BindQuotaDispatcherHostOnIOThread(
void BindConnectorOnIOThread(
int render_process_id, int render_process_id,
int render_frame_id, int render_frame_id,
storage::QuotaManager* quota_manager, storage::QuotaManager* quota_manager,
...@@ -43,39 +42,6 @@ void BindConnectorOnIOThread( ...@@ -43,39 +42,6 @@ void BindConnectorOnIOThread(
std::move(receiver)); std::move(receiver));
} }
} // namespace
// static
void QuotaDispatcherHost::CreateForWorker(
mojo::PendingReceiver<blink::mojom::QuotaDispatcherHost> receiver,
RenderProcessHost* host,
const url::Origin& origin) {
// TODO(crbug.com/779444): Save the |origin| here and use it rather than the
// one provided by QuotaDispatcher.
// Bind on the IO thread.
base::PostTask(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(
&BindConnectorOnIOThread, host->GetID(), MSG_ROUTING_NONE,
base::RetainedRef(host->GetStoragePartition()->GetQuotaManager()),
std::move(receiver)));
}
// static
void QuotaDispatcherHost::CreateForFrame(
RenderProcessHost* host,
int render_frame_id,
mojo::PendingReceiver<blink::mojom::QuotaDispatcherHost> receiver) {
// Bind on the IO thread.
base::PostTask(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(
&BindConnectorOnIOThread, host->GetID(), render_frame_id,
base::RetainedRef(host->GetStoragePartition()->GetQuotaManager()),
std::move(receiver)));
}
QuotaDispatcherHost::QuotaDispatcherHost( QuotaDispatcherHost::QuotaDispatcherHost(
int process_id, int process_id,
int render_frame_id, int render_frame_id,
......
...@@ -21,18 +21,13 @@ class Origin; ...@@ -21,18 +21,13 @@ class Origin;
namespace content { namespace content {
class QuotaPermissionContext; class QuotaPermissionContext;
class RenderProcessHost;
class QuotaDispatcherHost : public blink::mojom::QuotaDispatcherHost { class QuotaDispatcherHost : public blink::mojom::QuotaDispatcherHost {
public: public:
static void CreateForWorker( static void BindQuotaDispatcherHostOnIOThread(
mojo::PendingReceiver<blink::mojom::QuotaDispatcherHost> receiver, int render_process_id,
RenderProcessHost* host,
const url::Origin& origin);
static void CreateForFrame(
RenderProcessHost* host,
int render_frame_id, int render_frame_id,
storage::QuotaManager* quota_manager,
mojo::PendingReceiver<blink::mojom::QuotaDispatcherHost> receiver); mojo::PendingReceiver<blink::mojom::QuotaDispatcherHost> receiver);
QuotaDispatcherHost(int process_id, QuotaDispatcherHost(int process_id,
......
...@@ -115,6 +115,7 @@ ...@@ -115,6 +115,7 @@
#include "content/browser/permissions/permission_service_context.h" #include "content/browser/permissions/permission_service_context.h"
#include "content/browser/permissions/permission_service_impl.h" #include "content/browser/permissions/permission_service_impl.h"
#include "content/browser/push_messaging/push_messaging_manager.h" #include "content/browser/push_messaging/push_messaging_manager.h"
#include "content/browser/quota_dispatcher_host.h"
#include "content/browser/renderer_host/agent_metrics_collector.h" #include "content/browser/renderer_host/agent_metrics_collector.h"
#include "content/browser/renderer_host/clipboard_host_impl.h" #include "content/browser/renderer_host/clipboard_host_impl.h"
#include "content/browser/renderer_host/code_cache_host_impl.h" #include "content/browser/renderer_host/code_cache_host_impl.h"
...@@ -1981,6 +1982,23 @@ void RenderProcessHostImpl::BindVideoDecodePerfHistory( ...@@ -1981,6 +1982,23 @@ void RenderProcessHostImpl::BindVideoDecodePerfHistory(
std::move(receiver)); std::move(receiver));
} }
void RenderProcessHostImpl::BindQuotaDispatcherHost(
int render_frame_id,
const url::Origin& origin,
mojo::PendingReceiver<blink::mojom::QuotaDispatcherHost> receiver) {
// TODO(crbug.com/779444): Save the |origin| here and use it rather than the
// one provided by QuotaDispatcher.
// Bind on the IO thread.
base::PostTask(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(
&QuotaDispatcherHost::BindQuotaDispatcherHostOnIOThread, GetID(),
render_frame_id,
base::RetainedRef(GetStoragePartition()->GetQuotaManager()),
std::move(receiver)));
}
void RenderProcessHostImpl::CreateLockManager( void RenderProcessHostImpl::CreateLockManager(
int render_frame_id, int render_frame_id,
const url::Origin& origin, const url::Origin& origin,
......
...@@ -577,6 +577,14 @@ class CONTENT_EXPORT RenderProcessHostImpl ...@@ -577,6 +577,14 @@ class CONTENT_EXPORT RenderProcessHostImpl
mojo::PendingReceiver<media::mojom::VideoDecodePerfHistory> receiver) mojo::PendingReceiver<media::mojom::VideoDecodePerfHistory> receiver)
override; override;
// Binds |receiver| to the VideoDecodePerfHistory instance owned by the render
// process host, and is used by frames and workers via BrowserInterfaceBroker.
void BindQuotaDispatcherHost(
int render_frame_id,
const url::Origin& origin,
mojo::PendingReceiver<blink::mojom::QuotaDispatcherHost> receiver)
override;
// Binds |receiver| to the LockManager owned by |storage_partition_impl_|. // Binds |receiver| to the LockManager owned by |storage_partition_impl_|.
// |receiver| belongs to a frame or worker at |origin| hosted by this process. // |receiver| belongs to a frame or worker at |origin| hosted by this process.
// If it belongs to a frame, |render_frame_id| identifies it, otherwise it is // If it belongs to a frame, |render_frame_id| identifies it, otherwise it is
......
...@@ -81,8 +81,6 @@ class RendererInterfaceBinders { ...@@ -81,8 +81,6 @@ class RendererInterfaceBinders {
// interface requests from frames, binders registered on the frame itself // interface requests from frames, binders registered on the frame itself
// override binders registered here. // override binders registered here.
void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() { void RendererInterfaceBinders::InitializeParameterizedBinderRegistry() {
parameterized_binder_registry_.AddInterface(
base::BindRepeating(&QuotaDispatcherHost::CreateForWorker));
} }
RendererInterfaceBinders& GetRendererInterfaceBinders() { RendererInterfaceBinders& GetRendererInterfaceBinders() {
......
...@@ -164,18 +164,6 @@ const service_manager::Manifest& GetContentBrowserManifest() { ...@@ -164,18 +164,6 @@ const service_manager::Manifest& GetContentBrowserManifest() {
.RequireCapability("content_gpu", "browser") .RequireCapability("content_gpu", "browser")
.RequireCapability("resource_coordinator", "app") .RequireCapability("resource_coordinator", "app")
.RequireCapability("resource_coordinator", "heap_profiler_helper") .RequireCapability("resource_coordinator", "heap_profiler_helper")
.ExposeInterfaceFilterCapability_Deprecated(
"navigation:shared_worker", "renderer",
std::set<const char*>{
"blink.mojom.QuotaDispatcherHost"})
.ExposeInterfaceFilterCapability_Deprecated(
"navigation:dedicated_worker", "renderer",
std::set<const char*>{
"blink.mojom.QuotaDispatcherHost"})
.ExposeInterfaceFilterCapability_Deprecated(
"navigation:service_worker", "renderer",
std::set<const char*>{
"blink.mojom.QuotaDispatcherHost"})
.ExposeInterfaceFilterCapability_Deprecated( .ExposeInterfaceFilterCapability_Deprecated(
"navigation:frame", "renderer", "navigation:frame", "renderer",
std::set<const char*>{ std::set<const char*>{
...@@ -183,7 +171,6 @@ const service_manager::Manifest& GetContentBrowserManifest() { ...@@ -183,7 +171,6 @@ const service_manager::Manifest& GetContentBrowserManifest() {
"autofill.mojom.PasswordManagerDriver", "autofill.mojom.PasswordManagerDriver",
"blink.mojom.DisplayCutoutHost", "blink.mojom.DisplayCutoutHost",
"blink.mojom.Portal", "blink.mojom.Portal",
"blink.mojom.QuotaDispatcherHost",
"content.mojom.RendererAudioInputStreamFactory", "content.mojom.RendererAudioInputStreamFactory",
"content.mojom.RendererAudioOutputStreamFactory", "content.mojom.RendererAudioOutputStreamFactory",
"discardable_memory.mojom.DiscardableSharedMemoryManager", "discardable_memory.mojom.DiscardableSharedMemoryManager",
......
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
#include "third_party/blink/public/mojom/notifications/notification_service.mojom-forward.h" #include "third_party/blink/public/mojom/notifications/notification_service.mojom-forward.h"
#include "third_party/blink/public/mojom/payments/payment_app.mojom-forward.h" #include "third_party/blink/public/mojom/payments/payment_app.mojom-forward.h"
#include "third_party/blink/public/mojom/permissions/permission.mojom-forward.h" #include "third_party/blink/public/mojom/permissions/permission.mojom-forward.h"
#include "third_party/blink/public/mojom/quota/quota_dispatcher_host.mojom-forward.h"
#include "third_party/blink/public/mojom/websockets/websocket_connector.mojom-forward.h" #include "third_party/blink/public/mojom/websockets/websocket_connector.mojom-forward.h"
#include "ui/gfx/native_widget_types.h" #include "ui/gfx/native_widget_types.h"
...@@ -532,6 +533,10 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender, ...@@ -532,6 +533,10 @@ class CONTENT_EXPORT RenderProcessHost : public IPC::Sender,
receiver) = 0; receiver) = 0;
virtual void BindVideoDecodePerfHistory( virtual void BindVideoDecodePerfHistory(
mojo::PendingReceiver<media::mojom::VideoDecodePerfHistory> receiver) = 0; mojo::PendingReceiver<media::mojom::VideoDecodePerfHistory> receiver) = 0;
virtual void BindQuotaDispatcherHost(
int render_frame_id,
const url::Origin& origin,
mojo::PendingReceiver<blink::mojom::QuotaDispatcherHost> receiver) = 0;
virtual void CreateLockManager( virtual void CreateLockManager(
int render_frame_id, int render_frame_id,
const url::Origin& origin, const url::Origin& origin,
......
...@@ -198,6 +198,11 @@ class MockRenderProcessHost : public RenderProcessHost { ...@@ -198,6 +198,11 @@ class MockRenderProcessHost : public RenderProcessHost {
void BindVideoDecodePerfHistory( void BindVideoDecodePerfHistory(
mojo::PendingReceiver<media::mojom::VideoDecodePerfHistory> receiver) mojo::PendingReceiver<media::mojom::VideoDecodePerfHistory> receiver)
override {} override {}
void BindQuotaDispatcherHost(
int render_frame_id,
const url::Origin& origin,
mojo::PendingReceiver<blink::mojom::QuotaDispatcherHost> receiver)
override {}
void CreateLockManager( void CreateLockManager(
int render_frame_id, int render_frame_id,
const url::Origin& origin, const url::Origin& origin,
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
#include "base/location.h" #include "base/location.h"
#include "mojo/public/cpp/bindings/callback_helpers.h" #include "mojo/public/cpp/bindings/callback_helpers.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/public/platform/task_type.h" #include "third_party/blink/public/platform/task_type.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_storage_error_callback.h" #include "third_party/blink/renderer/bindings/modules/v8/v8_storage_error_callback.h"
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include "third_party/blink/renderer/modules/quota/quota_utils.h" #include "third_party/blink/renderer/modules/quota/quota_utils.h"
#include "services/service_manager/public/cpp/interface_provider.h" #include "third_party/blink/public/common/browser_interface_broker_proxy.h"
#include "third_party/blink/renderer/core/execution_context/execution_context.h" #include "third_party/blink/renderer/core/execution_context/execution_context.h"
namespace blink { namespace blink {
...@@ -12,8 +12,8 @@ namespace blink { ...@@ -12,8 +12,8 @@ namespace blink {
void ConnectToQuotaDispatcherHost( void ConnectToQuotaDispatcherHost(
ExecutionContext* execution_context, ExecutionContext* execution_context,
mojo::PendingReceiver<mojom::blink::QuotaDispatcherHost> receiver) { mojo::PendingReceiver<mojom::blink::QuotaDispatcherHost> receiver) {
if (auto* interface_provider = execution_context->GetInterfaceProvider()) execution_context->GetBrowserInterfaceBroker().GetInterface(
interface_provider->GetInterface(std::move(receiver)); std::move(receiver));
} }
} // namespace blink } // namespace blink
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#include "third_party/blink/renderer/modules/quota/storage_manager.h" #include "third_party/blink/renderer/modules/quota/storage_manager.h"
#include "mojo/public/cpp/bindings/callback_helpers.h" #include "mojo/public/cpp/bindings/callback_helpers.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "third_party/blink/public/mojom/quota/quota_types.mojom-blink.h" #include "third_party/blink/public/mojom/quota/quota_types.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h" #include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.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