Commit 420b029b authored by Julie Jeongeun Kim's avatar Julie Jeongeun Kim Committed by Commit Bot

Clean up old Mojo type for mojom::DisplayPrivate

This CL cleans up old mojo types for mojom::DisplayPrivate using
AssociatedRemote, PendingAssociatedReceiver, and AssociatedReceiver.

Bug: 955171
Change-Id: Ia8191e6f88b11db9d61481caafcca18e61037976
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1894664
Commit-Queue: Julie Kim <jkim@igalia.com>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Reviewed-by: default avatarenne <enne@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Cr-Commit-Position: refs/heads/master@{#712476}
parent 043ddfb3
......@@ -128,7 +128,8 @@ void DemoHost::Initialize(
sink_remote.InitWithNewEndpointAndPassReceiver();
auto client_receiver = root_params->compositor_frame_sink_client
.InitWithNewPipeAndPassReceiver();
root_params->display_private = mojo::MakeRequest(&display_private_);
root_params->display_private =
display_private_.BindNewEndpointAndPassReceiver();
root_params->display_client = display_client_->GetBoundRemote(nullptr);
constexpr viz::FrameSinkId root_frame_sink_id(0xdead, 0xbeef);
......
......@@ -13,6 +13,7 @@
#include "components/viz/host/host_display_client.h"
#include "components/viz/host/host_frame_sink_client.h"
#include "components/viz/host/host_frame_sink_manager.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
......@@ -54,7 +55,7 @@ class DemoHost : public viz::HostFrameSinkClient {
const gfx::AcceleratedWidget widget_;
gfx::Size size_;
viz::HostFrameSinkManager host_frame_sink_manager_;
viz::mojom::DisplayPrivateAssociatedPtr display_private_;
mojo::AssociatedRemote<viz::mojom::DisplayPrivate> display_private_;
std::unique_ptr<viz::HostDisplayClient> display_client_;
viz::ParentLocalSurfaceIdAllocator allocator_;
......
......@@ -57,14 +57,14 @@ struct RootCompositorFrameSinkData {
compositor_frame_sink.BindNewEndpointAndPassReceiver();
params->compositor_frame_sink_client =
compositor_frame_sink_client.BindInterfaceRemote();
params->display_private = MakeRequest(&display_private);
params->display_private = display_private.BindNewEndpointAndPassReceiver();
params->display_client = display_client.BindRemote();
return params;
}
mojo::AssociatedRemote<mojom::CompositorFrameSink> compositor_frame_sink;
MockCompositorFrameSinkClient compositor_frame_sink_client;
mojom::DisplayPrivateAssociatedPtr display_private;
mojo::AssociatedRemote<mojom::DisplayPrivate> display_private;
MockDisplayClient display_client;
};
......
......@@ -103,7 +103,7 @@ FuzzerBrowserProcess::BuildRootCompositorFrameSinkParams() {
params->compositor_frame_sink_client =
root_compositor_frame_sink_client_.BindInterfaceRemote();
params->display_private =
MakeRequestAssociatedWithDedicatedPipe(&display_private_);
display_private_.BindNewEndpointAndPassDedicatedReceiverForTesting();
params->display_client = display_client_.BindRemote();
params->external_begin_frame_controller =
MakeRequestAssociatedWithDedicatedPipe(
......
......@@ -53,7 +53,7 @@ class FuzzerBrowserProcess {
mojo::AssociatedRemote<mojom::CompositorFrameSink>
root_compositor_frame_sink_remote_;
FakeCompositorFrameSinkClient root_compositor_frame_sink_client_;
mojom::DisplayPrivateAssociatedPtr display_private_;
mojo::AssociatedRemote<mojom::DisplayPrivate> display_private_;
FakeDisplayClient display_client_;
mojom::ExternalBeginFrameControllerAssociatedPtr
external_begin_frame_controller_ptr_;
......
......@@ -43,14 +43,14 @@ struct RootCompositorFrameSinkData {
compositor_frame_sink.BindNewEndpointAndPassReceiver();
params->compositor_frame_sink_client =
compositor_frame_sink_client.BindInterfaceRemote();
params->display_private = MakeRequest(&display_private);
params->display_private = display_private.BindNewEndpointAndPassReceiver();
params->display_client = display_client.BindRemote();
return params;
}
mojo::AssociatedRemote<mojom::CompositorFrameSink> compositor_frame_sink;
MockCompositorFrameSinkClient compositor_frame_sink_client;
mojom::DisplayPrivateAssociatedPtr display_private;
mojo::AssociatedRemote<mojom::DisplayPrivate> display_private;
MockDisplayClient display_client;
};
......
......@@ -293,7 +293,7 @@ RootCompositorFrameSinkImpl::RootCompositorFrameSinkImpl(
mojo::PendingAssociatedReceiver<mojom::CompositorFrameSink>
frame_sink_receiver,
mojo::PendingRemote<mojom::CompositorFrameSinkClient> frame_sink_client,
mojom::DisplayPrivateAssociatedRequest display_request,
mojo::PendingAssociatedReceiver<mojom::DisplayPrivate> display_receiver,
mojo::Remote<mojom::DisplayClient> display_client,
std::unique_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source,
std::unique_ptr<ExternalBeginFrameSource> external_begin_frame_source,
......@@ -301,7 +301,7 @@ RootCompositorFrameSinkImpl::RootCompositorFrameSinkImpl(
: compositor_frame_sink_client_(std::move(frame_sink_client)),
compositor_frame_sink_receiver_(this, std::move(frame_sink_receiver)),
display_client_(std::move(display_client)),
display_private_binding_(this, std::move(display_request)),
display_private_receiver_(this, std::move(display_receiver)),
support_(std::make_unique<CompositorFrameSinkSupport>(
compositor_frame_sink_client_.get(),
frame_sink_manager,
......@@ -320,11 +320,11 @@ RootCompositorFrameSinkImpl::RootCompositorFrameSinkImpl(
}
void RootCompositorFrameSinkImpl::DisplayOutputSurfaceLost() {
// |display_| has encountered an error and needs to be recreated. Close
// |display_| has encountered an error and needs to be recreated. Reset
// message pipes from the client, the client will see the connection error and
// recreate the CompositorFrameSink+Display.
compositor_frame_sink_receiver_.reset();
display_private_binding_.Close();
display_private_receiver_.reset();
}
void RootCompositorFrameSinkImpl::DisplayWillDrawAndSwap(
......
......@@ -14,7 +14,6 @@
#include "components/viz/common/surfaces/local_surface_id.h"
#include "components/viz/service/display/display_client.h"
#include "components/viz/service/frame_sinks/compositor_frame_sink_support.h"
#include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
......@@ -97,7 +96,7 @@ class RootCompositorFrameSinkImpl : public mojom::CompositorFrameSink,
mojo::PendingAssociatedReceiver<mojom::CompositorFrameSink>
frame_sink_receiver,
mojo::PendingRemote<mojom::CompositorFrameSinkClient> frame_sink_client,
mojom::DisplayPrivateAssociatedRequest display_request,
mojo::PendingAssociatedReceiver<mojom::DisplayPrivate> display_receiver,
mojo::Remote<mojom::DisplayClient> display_client,
std::unique_ptr<SyntheticBeginFrameSource> synthetic_begin_frame_source,
std::unique_ptr<ExternalBeginFrameSource> external_begin_frame_source,
......@@ -122,7 +121,7 @@ class RootCompositorFrameSinkImpl : public mojom::CompositorFrameSink,
compositor_frame_sink_receiver_;
// |display_client_| may be NullRemote on platforms that do not use it.
mojo::Remote<mojom::DisplayClient> display_client_;
mojo::AssociatedBinding<mojom::DisplayPrivate> display_private_binding_;
mojo::AssociatedReceiver<mojom::DisplayPrivate> display_private_receiver_;
std::unique_ptr<VSyncParameterListener> vsync_listener_;
......
......@@ -492,7 +492,7 @@ void CompositorImpl::TearDownDisplayAndUnregisterRootFrameSink() {
// Note that while this is not a Sync IPC, the call to
// InvalidateFrameSinkId below will end up triggering a sync call to
// FrameSinkManager::DestroyCompositorFrameSink, as this is the root
// frame sink. Because |display_private_| is an associated interface to
// frame sink. Because |display_private_| is an associated remote to
// FrameSinkManager, this subsequent sync call will ensure ordered
// execution of this call.
display_private_->ForceImmediateDrawAndSwapIfPossible();
......@@ -827,7 +827,9 @@ void CompositorImpl::InitializeVizLayerTreeFrameSink(
mojo::PendingReceiver<viz::mojom::CompositorFrameSinkClient> client_receiver =
root_params->compositor_frame_sink_client
.InitWithNewPipeAndPassReceiver();
root_params->display_private = mojo::MakeRequest(&display_private_);
display_private_.reset();
root_params->display_private =
display_private_.BindNewEndpointAndPassReceiver();
display_client_ = std::make_unique<AndroidHostDisplayClient>(this);
root_params->display_client = display_client_->GetBoundRemote(task_runner);
......
......@@ -29,6 +29,7 @@
#include "content/public/browser/android/compositor.h"
#include "gpu/command_buffer/common/capabilities.h"
#include "gpu/ipc/common/surface_handle.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
#include "services/viz/public/cpp/gpu/context_provider_command_buffer.h"
#include "third_party/khronos/GLES2/gl2.h"
......@@ -252,7 +253,7 @@ class CONTENT_EXPORT CompositorImpl
bool has_submitted_frame_since_became_visible_ = false;
// Viz-specific members for communicating with the display.
viz::mojom::DisplayPrivateAssociatedPtr display_private_;
mojo::AssociatedRemote<viz::mojom::DisplayPrivate> display_private_;
std::unique_ptr<viz::HostDisplayClient> display_client_;
bool vsync_paused_ = false;
......
......@@ -36,7 +36,7 @@ struct RootCompositorFrameSinkParams {
pending_associated_receiver<CompositorFrameSink> compositor_frame_sink;
pending_remote<CompositorFrameSinkClient> compositor_frame_sink_client;
associated DisplayPrivate& display_private;
pending_associated_receiver<DisplayPrivate> display_private;
pending_remote<DisplayClient> display_client;
associated ExternalBeginFrameController&? external_begin_frame_controller;
......
......@@ -111,8 +111,9 @@ void HostContextFactoryPrivate::ConfigureCompositor(
mojo::PendingReceiver<viz::mojom::CompositorFrameSinkClient> client_receiver =
root_params->compositor_frame_sink_client
.InitWithNewPipeAndPassReceiver();
compositor_data.display_private.reset();
root_params->display_private =
mojo::MakeRequest(&compositor_data.display_private);
compositor_data.display_private.BindNewEndpointAndPassReceiver();
compositor_data.display_client =
std::make_unique<HostDisplayClient>(compositor);
root_params->display_client =
......
......@@ -13,6 +13,7 @@
#include "base/memory/scoped_refptr.h"
#include "components/viz/common/display/renderer_settings.h"
#include "components/viz/common/surfaces/frame_sink_id_allocator.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
#include "services/viz/privileged/mojom/compositing/external_begin_frame_controller.mojom.h"
......@@ -104,7 +105,7 @@ class HostContextFactoryPrivate : public ContextFactoryPrivate {
// Privileged interface that controls the display for a root
// CompositorFrameSink.
viz::mojom::DisplayPrivateAssociatedPtr display_private;
mojo::AssociatedRemote<viz::mojom::DisplayPrivate> display_private;
std::unique_ptr<viz::HostDisplayClient> display_client;
viz::mojom::ExternalBeginFrameControllerAssociatedPtr
external_begin_frame_controller;
......
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