Commit 82f6313b authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert XRPresentationClient to new Mojo types

This CL converts XRPresentationClientPtr in chrome, device and
blink to the new Mojo type, and uses
pending_receiver<XRPresentationClient> in vr_service.mojom.

Bug: 955171, 978694
Change-Id: I2ea508b31be493653edd2301758855b8c63efc79
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1828724Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarSam McNally <sammc@chromium.org>
Reviewed-by: default avatarPiotr Bialecki <bialpio@chromium.org>
Reviewed-by: default avatarBrandon Jones <bajones@chromium.org>
Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Commit-Queue: Miyoung Shin <myid.shin@igalia.com>
Cr-Commit-Position: refs/heads/master@{#702283}
parent 7067ee40
...@@ -202,7 +202,8 @@ void ArCoreGl::CreateSession(mojom::VRDisplayInfoPtr display_info, ...@@ -202,7 +202,8 @@ void ArCoreGl::CreateSession(mojom::VRDisplayInfoPtr display_info,
device::mojom::XRPresentationTransportMethod::DRAW_INTO_TEXTURE_MAILBOX; device::mojom::XRPresentationTransportMethod::DRAW_INTO_TEXTURE_MAILBOX;
auto submit_frame_sink = device::mojom::XRPresentationConnection::New(); auto submit_frame_sink = device::mojom::XRPresentationConnection::New();
submit_frame_sink->client_request = mojo::MakeRequest(&submit_client_); submit_frame_sink->client_receiver =
submit_client_.BindNewPipeAndPassReceiver();
submit_frame_sink->provider = presentation_provider.PassInterface(); submit_frame_sink->provider = presentation_provider.PassInterface();
submit_frame_sink->transport_options = std::move(transport_options); submit_frame_sink->transport_options = std::move(transport_options);
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "device/vr/util/fps_meter.h" #include "device/vr/util/fps_meter.h"
#include "mojo/public/cpp/bindings/associated_binding.h" #include "mojo/public/cpp/bindings/associated_binding.h"
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "ui/display/display.h" #include "ui/display/display.h"
#include "ui/gfx/geometry/point_f.h" #include "ui/gfx/geometry/point_f.h"
#include "ui/gfx/geometry/quaternion.h" #include "ui/gfx/geometry/quaternion.h"
...@@ -200,7 +201,7 @@ class ArCoreGl : public mojom::XRFrameDataProvider, ...@@ -200,7 +201,7 @@ class ArCoreGl : public mojom::XRFrameDataProvider,
void CloseBindingsIfOpen(); void CloseBindingsIfOpen();
mojo::Binding<device::mojom::XRPresentationProvider> presentation_binding_; mojo::Binding<device::mojom::XRPresentationProvider> presentation_binding_;
device::mojom::XRPresentationClientPtr submit_client_; mojo::Remote<device::mojom::XRPresentationClient> submit_client_;
base::OnceClosure pending_getframedata_; base::OnceClosure pending_getframedata_;
......
...@@ -196,7 +196,8 @@ void GvrSchedulerDelegate::ConnectPresentingService( ...@@ -196,7 +196,8 @@ void GvrSchedulerDelegate::ConnectPresentingService(
} }
auto submit_frame_sink = device::mojom::XRPresentationConnection::New(); auto submit_frame_sink = device::mojom::XRPresentationConnection::New();
submit_frame_sink->client_request = mojo::MakeRequest(&submit_client_); submit_frame_sink->client_receiver =
submit_client_.BindNewPipeAndPassReceiver();
submit_frame_sink->provider = presentation_provider.PassInterface(); submit_frame_sink->provider = presentation_provider.PassInterface();
submit_frame_sink->transport_options = std::move(transport_options); submit_frame_sink->transport_options = std::move(transport_options);
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "device/vr/public/mojom/vr_service.mojom.h" #include "device/vr/public/mojom/vr_service.mojom.h"
#include "device/vr/util/sliding_average.h" #include "device/vr/util/sliding_average.h"
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "ui/gfx/transform.h" #include "ui/gfx/transform.h"
namespace gfx { namespace gfx {
...@@ -194,7 +195,7 @@ class GvrSchedulerDelegate : public BaseSchedulerDelegate, ...@@ -194,7 +195,7 @@ class GvrSchedulerDelegate : public BaseSchedulerDelegate,
mojo::Binding<device::mojom::XRFrameDataProvider> frame_data_binding_; mojo::Binding<device::mojom::XRFrameDataProvider> frame_data_binding_;
std::vector<device::mojom::XRInputSourceStatePtr> input_states_; std::vector<device::mojom::XRInputSourceStatePtr> input_states_;
device::mojom::XRPresentationClientPtr submit_client_; mojo::Remote<device::mojom::XRPresentationClient> submit_client_;
base::queue<uint16_t> pending_frames_; base::queue<uint16_t> pending_frames_;
base::queue<std::pair<WebXrPresentationState::FrameIndexType, WebVrBounds>> base::queue<std::pair<WebXrPresentationState::FrameIndexType, WebVrBounds>>
......
...@@ -108,7 +108,7 @@ struct XRSession { ...@@ -108,7 +108,7 @@ struct XRSession {
// frames to a sink outside of Chrome. // frames to a sink outside of Chrome.
struct XRPresentationConnection { struct XRPresentationConnection {
XRPresentationProvider provider; XRPresentationProvider provider;
XRPresentationClient& client_request; pending_receiver<XRPresentationClient> client_receiver;
XRPresentationTransportOptions transport_options; XRPresentationTransportOptions transport_options;
}; };
......
...@@ -136,7 +136,7 @@ void XRCompositorCommon::SubmitFrameWithTextureHandle( ...@@ -136,7 +136,7 @@ void XRCompositorCommon::SubmitFrameWithTextureHandle(
} }
void XRCompositorCommon::CleanUp() { void XRCompositorCommon::CleanUp() {
submit_client_ = nullptr; submit_client_.reset();
webxr_has_pose_ = false; webxr_has_pose_ = false;
presentation_binding_.Close(); presentation_binding_.Close();
frame_data_binding_.Close(); frame_data_binding_.Close();
...@@ -234,7 +234,8 @@ void XRCompositorCommon::RequestSession( ...@@ -234,7 +234,8 @@ void XRCompositorCommon::RequestSession(
auto submit_frame_sink = device::mojom::XRPresentationConnection::New(); auto submit_frame_sink = device::mojom::XRPresentationConnection::New();
submit_frame_sink->provider = presentation_provider.PassInterface(); submit_frame_sink->provider = presentation_provider.PassInterface();
submit_frame_sink->client_request = mojo::MakeRequest(&submit_client_); submit_frame_sink->client_receiver =
submit_client_.BindNewPipeAndPassReceiver();
submit_frame_sink->transport_options = std::move(transport_options); submit_frame_sink->transport_options = std::move(transport_options);
auto session = device::mojom::XRSession::New(); auto session = device::mojom::XRSession::New();
...@@ -255,7 +256,7 @@ void XRCompositorCommon::ExitPresent() { ...@@ -255,7 +256,7 @@ void XRCompositorCommon::ExitPresent() {
webxr_has_pose_ = false; webxr_has_pose_ = false;
presentation_binding_.Close(); presentation_binding_.Close();
frame_data_binding_.Close(); frame_data_binding_.Close();
submit_client_ = nullptr; submit_client_.reset();
StopRuntime(); StopRuntime();
pending_frame_.reset(); pending_frame_.reset();
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "device/vr/util/sliding_average.h" #include "device/vr/util/sliding_average.h"
#include "device/vr/vr_device.h" #include "device/vr/vr_device.h"
#include "mojo/public/cpp/bindings/binding.h" #include "mojo/public/cpp/bindings/binding.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/platform_handle.h" #include "mojo/public/cpp/system/platform_handle.h"
#include "ui/gfx/geometry/rect_f.h" #include "ui/gfx/geometry/rect_f.h"
...@@ -169,7 +170,7 @@ class XRCompositorCommon : public base::Thread, ...@@ -169,7 +170,7 @@ class XRCompositorCommon : public base::Thread,
gfx::RectF right_webxr_bounds_; gfx::RectF right_webxr_bounds_;
gfx::Size source_size_; gfx::Size source_size_;
mojom::XRPresentationClientPtr submit_client_; mojo::Remote<mojom::XRPresentationClient> submit_client_;
SubmitOverlayTextureCallback overlay_submit_callback_; SubmitOverlayTextureCallback overlay_submit_callback_;
RequestNotificationOnWebXrSubmittedCallback on_webxr_submitted_; RequestNotificationOnWebXrSubmittedCallback on_webxr_submitted_;
bool webxr_has_pose_ = false; bool webxr_has_pose_ = false;
......
...@@ -576,7 +576,7 @@ void VRDisplay::OnRequestImmersiveSessionReturned( ...@@ -576,7 +576,7 @@ void VRDisplay::OnRequestImmersiveSessionReturned(
frame_transport_ = MakeGarbageCollected<XRFrameTransport>(); frame_transport_ = MakeGarbageCollected<XRFrameTransport>();
frame_transport_->BindSubmitFrameClient( frame_transport_->BindSubmitFrameClient(
std::move(session->submit_frame_sink->client_request)); std::move(session->submit_frame_sink->client_receiver));
frame_transport_->SetTransportOptions( frame_transport_->SetTransportOptions(
std::move(session->submit_frame_sink->transport_options)); std::move(session->submit_frame_sink->transport_options));
......
...@@ -89,7 +89,7 @@ void XRFrameProvider::BeginImmersiveSession( ...@@ -89,7 +89,7 @@ void XRFrameProvider::BeginImmersiveSession(
&XRFrameProvider::OnProviderConnectionError, WrapWeakPersistent(this))); &XRFrameProvider::OnProviderConnectionError, WrapWeakPersistent(this)));
frame_transport_->BindSubmitFrameClient( frame_transport_->BindSubmitFrameClient(
std::move(session_ptr->submit_frame_sink->client_request)); std::move(session_ptr->submit_frame_sink->client_receiver));
frame_transport_->SetTransportOptions( frame_transport_->SetTransportOptions(
std::move(session_ptr->submit_frame_sink->transport_options)); std::move(session_ptr->submit_frame_sink->transport_options));
frame_transport_->PresentChange(); frame_transport_->PresentChange();
......
...@@ -26,7 +26,6 @@ class XRFrameProvider final : public GarbageCollected<XRFrameProvider> { ...@@ -26,7 +26,6 @@ class XRFrameProvider final : public GarbageCollected<XRFrameProvider> {
explicit XRFrameProvider(XR*); explicit XRFrameProvider(XR*);
XRSession* immersive_session() const { return immersive_session_; } XRSession* immersive_session() const { return immersive_session_; }
device::mojom::blink::XRPresentationClientPtr GetSubmitFrameClient();
void BeginImmersiveSession(XRSession* session, void BeginImmersiveSession(XRSession* session,
device::mojom::blink::XRSessionPtr session_ptr); device::mojom::blink::XRSessionPtr session_ptr);
......
...@@ -574,7 +574,7 @@ class MockRuntime { ...@@ -574,7 +574,7 @@ class MockRuntime {
let submit_frame_sink; let submit_frame_sink;
if (result.supportsSession) { if (result.supportsSession) {
submit_frame_sink = { submit_frame_sink = {
clientRequest: this.presentation_provider_.getClientRequest(), clientReceiver: this.presentation_provider_.getClientReceiver(),
provider: this.presentation_provider_.bindProvider(sessionOptions), provider: this.presentation_provider_.bindProvider(sessionOptions),
transportOptions: options transportOptions: options
}; };
...@@ -957,7 +957,7 @@ class MockXRPresentationProvider { ...@@ -957,7 +957,7 @@ class MockXRPresentationProvider {
return providerPtr; return providerPtr;
} }
getClientRequest() { getClientReceiver() {
this.submitFrameClient_ = new device.mojom.XRPresentationClientPtr(); this.submitFrameClient_ = new device.mojom.XRPresentationClientPtr();
return mojo.makeRequest(this.submitFrameClient_); return mojo.makeRequest(this.submitFrameClient_);
} }
......
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