Commit 027cfb44 authored by Alex Cooper's avatar Alex Cooper Committed by Commit Bot

Remove Plumbing for IsolatedXRGamepadProviderFactory

The IsolatedXRGamepadProviderFactory was only used by WebVR.  Since that
has now been removed, we do not need to plumb the factory or create the
gamepad provider to be considered a proper XRDevice. As a result of this
the IsolatedGamepadDataFetcher is no longer used and can be removed.

To better stage the cleanup, only the plumbing for the factory is being
removed at this time.  This will allow the runtimes to be refactored
independently. When nothing implements the interfaces anymore they will
be removed.

Bug: 1017856
Change-Id: I87d92c6236ed547b16a32f507d6381636ef30a5e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1880011Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Reviewed-by: default avatarJacob DeWitt <jacde@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Cr-Commit-Position: refs/heads/master@{#709667}
parent 23dd050b
......@@ -7,8 +7,6 @@
#include "base/bind.h"
#include "chrome/browser/vr/service/vr_ui_host.h"
#include "chrome/browser/vr/service/xr_device_service.h"
#include "device/vr/buildflags/buildflags.h"
#include "device/vr/isolated_gamepad_data_fetcher.h"
namespace {
constexpr int kMaxRetries = 3;
......@@ -37,8 +35,6 @@ bool IsolatedVRDeviceProvider::Initialized() {
void IsolatedVRDeviceProvider::OnDeviceAdded(
mojo::PendingRemote<device::mojom::XRRuntime> device,
mojo::PendingRemote<device::mojom::IsolatedXRGamepadProviderFactory>
gamepad_factory,
mojo::PendingRemote<device::mojom::XRCompositorHost> compositor_host,
device::mojom::XRDeviceId device_id) {
add_device_callback_.Run(device_id, nullptr, std::move(device));
......@@ -46,15 +42,11 @@ void IsolatedVRDeviceProvider::OnDeviceAdded(
auto ui_host =
(*VRUiHost::GetFactory())(device_id, std::move(compositor_host));
ui_host_map_.insert(std::make_pair(device_id, std::move(ui_host)));
device::IsolatedGamepadDataFetcher::Factory::AddGamepad(
device_id, std::move(gamepad_factory));
}
void IsolatedVRDeviceProvider::OnDeviceRemoved(device::mojom::XRDeviceId id) {
remove_device_callback_.Run(id);
ui_host_map_.erase(id);
device::IsolatedGamepadDataFetcher::Factory::RemoveGamepad(id);
}
void IsolatedVRDeviceProvider::OnServerError() {
......@@ -63,7 +55,6 @@ void IsolatedVRDeviceProvider::OnServerError() {
for (auto& entry : ui_host_map_) {
auto id = entry.first;
remove_device_callback_.Run(id);
device::IsolatedGamepadDataFetcher::Factory::RemoveGamepad(id);
}
ui_host_map_.clear();
......@@ -107,12 +98,7 @@ void IsolatedVRDeviceProvider::SetupDeviceProvider() {
IsolatedVRDeviceProvider::IsolatedVRDeviceProvider() = default;
IsolatedVRDeviceProvider::~IsolatedVRDeviceProvider() {
for (auto& entry : ui_host_map_) {
auto device_id = entry.first;
device::IsolatedGamepadDataFetcher::Factory::RemoveGamepad(device_id);
}
// Default destructor handles renderer_host_map_ cleanup.
}
// Default destructor handles renderer_host_map_ cleanup.
IsolatedVRDeviceProvider::~IsolatedVRDeviceProvider() = default;
} // namespace vr
......@@ -41,8 +41,6 @@ class IsolatedVRDeviceProvider
// IsolatedXRRuntimeProviderClient
void OnDeviceAdded(
mojo::PendingRemote<device::mojom::XRRuntime> device,
mojo::PendingRemote<device::mojom::IsolatedXRGamepadProviderFactory>
gamepad_factory,
mojo::PendingRemote<device::mojom::XRCompositorHost> compositor_host,
device::mojom::XRDeviceId device_id) override;
void OnDeviceRemoved(device::mojom::XRDeviceId id) override;
......
......@@ -46,8 +46,8 @@ std::unique_ptr<VrDeviceT> EnableRuntime(
static_cast<int>(device->GetId()));
// "Device" here refers to a runtime + hardware pair, not necessarily
// a physical device.
client->OnDeviceAdded(device->BindXRRuntime(), device->BindGamepadFactory(),
device->BindCompositorHost(), device->GetId());
client->OnDeviceAdded(device->BindXRRuntime(), device->BindCompositorHost(),
device->GetId());
return device;
}
......
......@@ -93,18 +93,6 @@ if (enable_vr) {
configs += [ "//third_party/gvr-android-sdk:libgvr_config" ]
}
if (!is_android) {
sources += [
"isolated_gamepad_data_fetcher.cc",
"isolated_gamepad_data_fetcher.h",
]
deps += [
"//device/gamepad",
"//device/gamepad/public/cpp:shared_with_blink",
]
}
if (enable_openvr) {
deps += [ "//third_party/openvr:openvr" ]
sources += [
......
This diff is collapsed.
// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef DEVICE_VR_ISOLATED_GAMEPAD_DATA_FETCHER_H_
#define DEVICE_VR_ISOLATED_GAMEPAD_DATA_FETCHER_H_
#include "device/gamepad/gamepad_data_fetcher.h"
#include "device/vr/public/mojom/isolated_xr_service.mojom.h"
#include "device/vr/vr_device.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
namespace device {
class IsolatedGamepadDataFetcher : public GamepadDataFetcher {
public:
class DEVICE_VR_EXPORT Factory : public GamepadDataFetcherFactory {
public:
Factory(device::mojom::XRDeviceId display_id,
mojo::PendingRemote<device::mojom::IsolatedXRGamepadProviderFactory>
factory);
~Factory() override;
std::unique_ptr<GamepadDataFetcher> CreateDataFetcher() override;
GamepadSource source() override;
static void AddGamepad(
device::mojom::XRDeviceId device_id,
mojo::PendingRemote<device::mojom::IsolatedXRGamepadProviderFactory>
gamepad_factory);
static void RemoveGamepad(device::mojom::XRDeviceId device_id);
private:
device::mojom::XRDeviceId display_id_;
mojo::Remote<device::mojom::IsolatedXRGamepadProviderFactory> factory_;
};
IsolatedGamepadDataFetcher(
device::mojom::XRDeviceId display_id,
mojo::PendingRemote<device::mojom::IsolatedXRGamepadProvider> provider);
~IsolatedGamepadDataFetcher() override;
GamepadSource source() override;
void GetGamepadData(bool devices_changed_hint) override;
void PauseHint(bool paused) override;
void OnAddedToProvider() override;
void OnDataUpdated(device::mojom::XRGamepadDataPtr data);
private:
device::mojom::XRDeviceId display_id_;
bool have_outstanding_request_ = false;
std::set<unsigned int> active_gamepads_;
device::mojom::XRGamepadDataPtr data_;
mojo::Remote<device::mojom::IsolatedXRGamepadProvider>
provider_; // Bound on the polling thread.
mojo::PendingRemote<device::mojom::IsolatedXRGamepadProvider>
pending_provider_; // Received on the UI thread, bound when polled.
DISALLOW_COPY_AND_ASSIGN(IsolatedGamepadDataFetcher);
};
} // namespace device
#endif // DEVICE_VR_ISOLATED_GAMEPAD_DATA_FETCHER_H_
......@@ -198,7 +198,6 @@ interface IsolatedXRRuntimeProviderClient {
// Called when runtimes are initially enumerated, or when devices are later
// attached and become available.
OnDeviceAdded(pending_remote<XRRuntime> runtime,
pending_remote<IsolatedXRGamepadProviderFactory> gamepad_factory,
pending_remote<XRCompositorHost> compositor_host,
device.mojom.XRDeviceId device_id);
......
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