Commit 573fff95 authored by Alex Cooper's avatar Alex Cooper Committed by Commit Bot

Remove WebVR support from Windows Mixed Reality runtime

This removes WMR's support for WebVR, and refactors some helpers that
existed to simplify those code paths.

Also fixes a few lint errors for these files.

Fixed: 1017847
Change-Id: I95d60fe4892f37febbda0a383e2bf270441f2845
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1879661Reviewed-by: default avatarJacob DeWitt <jacde@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709692}
parent 62ce6544
...@@ -70,11 +70,6 @@ MixedRealityDevice::~MixedRealityDevice() { ...@@ -70,11 +70,6 @@ MixedRealityDevice::~MixedRealityDevice() {
Shutdown(); Shutdown();
} }
mojo::PendingRemote<mojom::IsolatedXRGamepadProviderFactory>
MixedRealityDevice::BindGamepadFactory() {
return gamepad_provider_factory_receiver_.BindNewPipeAndPassRemote();
}
mojo::PendingRemote<mojom::XRCompositorHost> mojo::PendingRemote<mojom::XRCompositorHost>
MixedRealityDevice::BindCompositorHost() { MixedRealityDevice::BindCompositorHost() {
return compositor_host_receiver_.BindNewPipeAndPassRemote(); return compositor_host_receiver_.BindNewPipeAndPassRemote();
...@@ -103,13 +98,6 @@ void MixedRealityDevice::RequestSession( ...@@ -103,13 +98,6 @@ void MixedRealityDevice::RequestSession(
return; return;
} }
if (provider_receiver_) {
render_loop_->task_runner()->PostTask(
FROM_HERE, base::BindOnce(&XRCompositorCommon::RequestGamepadProvider,
base::Unretained(render_loop_.get()),
std::move(provider_receiver_)));
}
if (overlay_receiver_) { if (overlay_receiver_) {
render_loop_->task_runner()->PostTask( render_loop_->task_runner()->PostTask(
FROM_HERE, base::BindOnce(&XRCompositorCommon::RequestOverlay, FROM_HERE, base::BindOnce(&XRCompositorCommon::RequestOverlay,
...@@ -176,20 +164,6 @@ void MixedRealityDevice::OnRequestSessionResult( ...@@ -176,20 +164,6 @@ void MixedRealityDevice::OnRequestSessionResult(
base::Unretained(this))); base::Unretained(this)));
} }
void MixedRealityDevice::GetIsolatedXRGamepadProvider(
mojo::PendingReceiver<mojom::IsolatedXRGamepadProvider> provider_receiver) {
if (!render_loop_)
CreateRenderLoop();
if (render_loop_->IsRunning()) {
render_loop_->task_runner()->PostTask(
FROM_HERE, base::BindOnce(&XRCompositorCommon::RequestGamepadProvider,
base::Unretained(render_loop_.get()),
std::move(provider_receiver)));
} else {
provider_receiver_ = std::move(provider_receiver);
}
}
void MixedRealityDevice::CreateImmersiveOverlay( void MixedRealityDevice::CreateImmersiveOverlay(
mojo::PendingReceiver<mojom::ImmersiveOverlay> overlay_receiver) { mojo::PendingReceiver<mojom::ImmersiveOverlay> overlay_receiver) {
if (!render_loop_) if (!render_loop_)
...@@ -211,15 +185,12 @@ void MixedRealityDevice::SetFrameDataRestricted(bool restricted) { ...@@ -211,15 +185,12 @@ void MixedRealityDevice::SetFrameDataRestricted(bool restricted) {
} }
void MixedRealityDevice::OnPresentingControllerMojoConnectionError() { void MixedRealityDevice::OnPresentingControllerMojoConnectionError() {
if (!render_loop_) if (render_loop_) {
CreateRenderLoop(); render_loop_->task_runner()->PostTask(
render_loop_->task_runner()->PostTask( FROM_HERE, base::BindOnce(&XRCompositorCommon::ExitPresent,
FROM_HERE, base::BindOnce(&XRCompositorCommon::ExitPresent, base::Unretained(render_loop_.get())));
base::Unretained(render_loop_.get()))); }
// Don't stop the render loop here. We need to keep the gamepad provider alive
// so that we don't lose a pending mojo gamepad_callback_.
// TODO(https://crbug.com/875187): Alternatively, we could recreate the
// provider on the next session, or look into why the callback gets lost.
OnExitPresent(); OnExitPresent();
exclusive_controller_receiver_.reset(); exclusive_controller_receiver_.reset();
} }
......
...@@ -22,14 +22,11 @@ namespace device { ...@@ -22,14 +22,11 @@ namespace device {
class DEVICE_VR_EXPORT MixedRealityDevice class DEVICE_VR_EXPORT MixedRealityDevice
: public VRDeviceBase, : public VRDeviceBase,
public mojom::XRSessionController, public mojom::XRSessionController,
public mojom::IsolatedXRGamepadProviderFactory,
public mojom::XRCompositorHost { public mojom::XRCompositorHost {
public: public:
MixedRealityDevice(); MixedRealityDevice();
~MixedRealityDevice() override; ~MixedRealityDevice() override;
mojo::PendingRemote<mojom::IsolatedXRGamepadProviderFactory>
BindGamepadFactory();
mojo::PendingRemote<mojom::XRCompositorHost> BindCompositorHost(); mojo::PendingRemote<mojom::XRCompositorHost> BindCompositorHost();
private: private:
...@@ -41,11 +38,6 @@ class DEVICE_VR_EXPORT MixedRealityDevice ...@@ -41,11 +38,6 @@ class DEVICE_VR_EXPORT MixedRealityDevice
// XRSessionController // XRSessionController
void SetFrameDataRestricted(bool restricted) override; void SetFrameDataRestricted(bool restricted) override;
// mojom::IsolatedXRGamepadProviderFactory
void GetIsolatedXRGamepadProvider(
mojo::PendingReceiver<mojom::IsolatedXRGamepadProvider> provider_receiver)
override;
// XRCompositorHost // XRCompositorHost
void CreateImmersiveOverlay( void CreateImmersiveOverlay(
mojo::PendingReceiver<mojom::ImmersiveOverlay> overlay_receiver) override; mojo::PendingReceiver<mojom::ImmersiveOverlay> overlay_receiver) override;
...@@ -60,10 +52,6 @@ class DEVICE_VR_EXPORT MixedRealityDevice ...@@ -60,10 +52,6 @@ class DEVICE_VR_EXPORT MixedRealityDevice
std::unique_ptr<XRCompositorCommon> render_loop_; std::unique_ptr<XRCompositorCommon> render_loop_;
mojo::Receiver<mojom::IsolatedXRGamepadProviderFactory>
gamepad_provider_factory_receiver_{this};
mojo::PendingReceiver<mojom::IsolatedXRGamepadProvider> provider_receiver_;
mojo::Receiver<mojom::XRCompositorHost> compositor_host_receiver_{this}; mojo::Receiver<mojom::XRCompositorHost> compositor_host_receiver_{this};
mojo::PendingReceiver<mojom::ImmersiveOverlay> overlay_receiver_; mojo::PendingReceiver<mojom::ImmersiveOverlay> overlay_receiver_;
......
...@@ -13,31 +13,10 @@ ...@@ -13,31 +13,10 @@
#include <vector> #include <vector>
#include "base/callback_list.h" #include "base/callback_list.h"
#include "device/gamepad/public/cpp/gamepads.h"
#include "device/vr/public/mojom/isolated_xr_service.mojom.h"
#include "device/vr/public/mojom/vr_service.mojom.h" #include "device/vr/public/mojom/vr_service.mojom.h"
#include "device/vr/util/gamepad_builder.h"
namespace device { namespace device {
enum class ButtonName {
kSelect,
kGrip,
kTouchpad,
kThumbstick,
};
struct ParsedInputState {
mojom::XRInputSourceStatePtr source_state;
std::unordered_map<ButtonName, GamepadBuilder::ButtonData> button_data;
GamepadPose gamepad_pose;
uint16_t vendor_id = 0;
uint16_t product_id = 0;
ParsedInputState();
~ParsedInputState();
ParsedInputState(ParsedInputState&& other);
};
class WMRCoordinateSystem; class WMRCoordinateSystem;
class WMRInputManager; class WMRInputManager;
class WMRInputSourceState; class WMRInputSourceState;
...@@ -56,16 +35,14 @@ class MixedRealityInputHelper { ...@@ -56,16 +35,14 @@ class MixedRealityInputHelper {
const WMRCoordinateSystem* origin, const WMRCoordinateSystem* origin,
const WMRTimestamp* timestamp); const WMRTimestamp* timestamp);
mojom::XRGamepadDataPtr GetWebVRGamepadData(const WMRCoordinateSystem* origin,
const WMRTimestamp* timestamp);
void Dispose(); void Dispose();
private: private:
bool EnsureSpatialInteractionManager(); bool EnsureSpatialInteractionManager();
ParsedInputState ParseWindowsSourceState(const WMRInputSourceState* state, mojom::XRInputSourceStatePtr ParseWindowsSourceState(
const WMRCoordinateSystem* origin); const WMRInputSourceState* state,
const WMRCoordinateSystem* origin);
// These event subscriptions can come back on a different thread, while // These event subscriptions can come back on a different thread, while
// everything else is expected to come back on the same thread. // everything else is expected to come back on the same thread.
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include <algorithm> #include <algorithm>
#include <limits> #include <limits>
#include <utility> #include <utility>
#include <vector>
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
...@@ -52,7 +51,7 @@ using Microsoft::WRL::ComPtr; ...@@ -52,7 +51,7 @@ using Microsoft::WRL::ComPtr;
class MixedRealityWindow : public gfx::WindowImpl { class MixedRealityWindow : public gfx::WindowImpl {
public: public:
MixedRealityWindow(base::OnceCallback<void()> on_destroyed) explicit MixedRealityWindow(base::OnceCallback<void()> on_destroyed)
: gfx::WindowImpl(), on_destroyed_(std::move(on_destroyed)) { : gfx::WindowImpl(), on_destroyed_(std::move(on_destroyed)) {
set_window_style(WS_OVERLAPPED); set_window_style(WS_OVERLAPPED);
} }
...@@ -89,8 +88,7 @@ gfx::Transform ConvertToGfxTransform(const Matrix4x4& matrix) { ...@@ -89,8 +88,7 @@ gfx::Transform ConvertToGfxTransform(const Matrix4x4& matrix) {
matrix.M11, matrix.M21, matrix.M31, matrix.M41, matrix.M11, matrix.M21, matrix.M31, matrix.M41,
matrix.M12, matrix.M22, matrix.M32, matrix.M42, matrix.M12, matrix.M22, matrix.M32, matrix.M42,
matrix.M13, matrix.M23, matrix.M33, matrix.M43, matrix.M13, matrix.M23, matrix.M33, matrix.M43,
matrix.M14, matrix.M24, matrix.M34, matrix.M44 matrix.M14, matrix.M24, matrix.M34, matrix.M44);
);
// clang-format on // clang-format on
} }
...@@ -504,21 +502,6 @@ void MixedRealityRenderLoop::StartPresenting() { ...@@ -504,21 +502,6 @@ void MixedRealityRenderLoop::StartPresenting() {
ShowWindow(window_->hwnd(), SW_SHOW); ShowWindow(window_->hwnd(), SW_SHOW);
} }
mojom::XRGamepadDataPtr MixedRealityRenderLoop::GetNextGamepadData() {
if (!timestamp_) {
WMRLogging::TraceError(WMRErrorLocation::kGamepadMissingTimestamp);
return nullptr;
}
if (!anchor_origin_) {
WMRLogging::TraceError(WMRErrorLocation::kGamepadMissingOrigin);
return nullptr;
}
return input_helper_->GetWebVRGamepadData(anchor_origin_.get(),
timestamp_.get());
}
struct EyeToWorldDecomposed { struct EyeToWorldDecomposed {
gfx::Quaternion world_to_eye_rotation; gfx::Quaternion world_to_eye_rotation;
gfx::Point3F eye_in_world_space; gfx::Point3F eye_in_world_space;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define DEVICE_VR_WINDOWS_MIXED_REALITY_MIXED_REALITY_RENDERLOOP_H_ #define DEVICE_VR_WINDOWS_MIXED_REALITY_MIXED_REALITY_RENDERLOOP_H_
#include <memory> #include <memory>
#include <vector>
#include "base/callback.h" #include "base/callback.h"
#include "base/callback_list.h" #include "base/callback_list.h"
...@@ -57,7 +58,6 @@ class MixedRealityRenderLoop : public XRCompositorCommon { ...@@ -57,7 +58,6 @@ class MixedRealityRenderLoop : public XRCompositorCommon {
// XRDeviceAbstraction: // XRDeviceAbstraction:
mojom::XRFrameDataPtr GetNextFrameData() override; mojom::XRFrameDataPtr GetNextFrameData() override;
mojom::XRGamepadDataPtr GetNextGamepadData() override;
bool PreComposite() override; bool PreComposite() override;
bool SubmitCompositedFrame() override; bool SubmitCompositedFrame() override;
......
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