0

Split VROrientationDevice into it's own component

This change creates a new target containing only VROrientationDevice.
This will allow embedders (and content) to link against just the only
VROrientation device so that it doesn't need to link in all of device/vr
if that's the only device that it wants/needs.

Future work can create components for each device, such that including
AR, GVR, or each of the immersive (windows) runtimes can be done
independent of each other.

Bug: 1070807
Change-Id: I12c8ec78a60e876d820cac881354a088b9843d73
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2154399
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#761164}
This commit is contained in:
Alexander Cooper
2020-04-21 22:16:35 +00:00
committed by Commit Bot
parent 51e3c25ab5
commit cb573b0d29
16 changed files with 83 additions and 25 deletions

@ -5449,6 +5449,7 @@ jumbo_static_library("browser") {
deps += [
"//chrome/browser/vr:vr_common",
"//device/vr",
"//device/vr/orientation",
"//device/vr/public/cpp",
]
}

@ -126,6 +126,7 @@ static_library("vr_android") {
"//content/public/browser",
"//content/public/common",
"//device/vr",
"//device/vr:vr_base",
"//device/vr/buildflags:buildflags",
"//services/device/public/mojom",
"//services/metrics/public/cpp:ukm_builders",

@ -678,6 +678,7 @@ if (!is_android) {
"//chrome/test:xr_browser_tests_common",
"//device/vr:vr",
"//device/vr/buildflags:buildflags",
"//device/vr/orientation",
"//device/vr/public/mojom",
"//device/vr/public/mojom:test_mojom",
]

@ -27,6 +27,7 @@ source_set("lib") {
"//content/public/common:common_sources",
"//device/base",
"//device/vr:vr",
"//device/vr:vr_base",
"//device/vr/public/mojom",
"//device/vr/public/mojom:test_mojom",
]

@ -11,7 +11,6 @@
#include "content/public/common/content_switches.h"
#include "device/base/features.h"
#include "device/vr/buildflags/buildflags.h"
#include "device/vr/vr_device_base.h"
#if BUILDFLAG(ENABLE_OPENVR)
#include "device/vr/openvr/openvr_device.h"

@ -334,6 +334,7 @@ test("device_unittests") {
deps += [
"//device/vr",
"//device/vr:vr_fakes",
"//device/vr/orientation",
"//device/vr/public/mojom",
"//services/device/public/cpp/generic_sensor",
"//ui/display",

@ -9,17 +9,39 @@ if (is_android) {
}
if (enable_vr) {
# TODO(https://crbug.com/1073113): Flesh out and cleanup this target.
component("vr_base") {
visibility = [
# TODO(https://crbug.com/843374): Move arcore_device
"//chrome/browser/android/vr/*",
"//content/services/isolated_xr_device/*",
"//device/vr/*",
]
output_name = "device_vr_base"
defines = [ "IS_DEVICE_VR_BASE_IMPL" ]
sources = [
"vr_device.h",
"vr_device_base.cc",
"vr_device_base.h",
]
public_deps = [
"//device/vr/public/cpp",
"//device/vr/public/mojom",
]
deps = [
"//base",
"//mojo/public/cpp/bindings",
]
}
component("vr") {
output_name = "device_vr"
defines = [ "DEVICE_VR_IMPLEMENTATION" ]
sources = [
"orientation/orientation_device.cc",
"orientation/orientation_device.h",
"orientation/orientation_device_provider.cc",
"orientation/orientation_device_provider.h",
"orientation/orientation_session.cc",
"orientation/orientation_session.h",
"util/fps_meter.cc",
"util/fps_meter.h",
"util/gamepad_builder.cc",
@ -34,14 +56,12 @@ if (enable_vr) {
"util/transform_utils.h",
"util/xr_standard_gamepad_builder.cc",
"util/xr_standard_gamepad_builder.h",
"vr_device.h",
"vr_device_base.cc",
"vr_device_base.h",
"vr_export.h",
]
public_deps = [ "//device/vr/public/cpp" ]
deps = [
":vr_base",
"//base",
"//components/ukm:ukm",
"//device/base",
@ -267,7 +287,9 @@ if (enable_vr) {
public_deps = [
":vr",
":vr_base",
"//base",
"//device/vr/orientation",
"//device/vr/public/mojom",
"//mojo/public/cpp/bindings",
"//services/device/public/cpp/generic_sensor",

@ -12,6 +12,7 @@
#include "base/android/scoped_java_ref.h"
#include "base/macros.h"
#include "device/vr/vr_device_base.h"
#include "device/vr/vr_export.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "third_party/gvr-android-sdk/src/libraries/headers/vr/gvr/capi/include/gvr_types.h"

@ -11,6 +11,7 @@
#include "base/single_thread_task_runner.h"
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "device/vr/vr_device_base.h"
#include "device/vr/vr_export.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"

@ -10,6 +10,7 @@
#include "base/macros.h"
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "device/vr/vr_device_base.h"
#include "device/vr/vr_export.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"

@ -0,0 +1,30 @@
# Copyright 2020 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.
import("//device/vr/buildflags/buildflags.gni")
assert(enable_vr)
component("orientation") {
output_name = "vr_orientation"
defines = [ "IS_VR_ORIENTATION_IMPL" ]
sources = [
"orientation_device.cc",
"orientation_device.h",
"orientation_device_provider.cc",
"orientation_device_provider.h",
"orientation_session.cc",
"orientation_session.h",
]
public_deps = [ "//device/vr/public/cpp" ]
deps = [
"//base",
"//device/vr:vr_base",
"//mojo/public/cpp/bindings",
"//services/device/public/cpp/generic_sensor",
"//ui/gfx",
]
}

@ -8,6 +8,7 @@
#include <memory>
#include "base/callback_forward.h"
#include "base/component_export.h"
#include "base/macros.h"
#include "base/threading/simple_thread.h"
#include "build/build_config.h"
@ -37,8 +38,9 @@ static constexpr mojom::SensorType kOrientationSensorType =
#endif
// This class connects the orientation sensor events to the Web VR apis.
class DEVICE_VR_EXPORT VROrientationDevice : public VRDeviceBase,
public mojom::SensorClient {
class COMPONENT_EXPORT(VR_ORIENTATION) VROrientationDevice
: public VRDeviceBase,
public mojom::SensorClient {
public:
VROrientationDevice(mojom::SensorProvider* sensor_provider,
base::OnceClosure ready_callback);

@ -8,17 +8,18 @@
#include <memory>
#include "base/callback_forward.h"
#include "base/component_export.h"
#include "base/macros.h"
#include "device/vr/orientation/orientation_device.h"
#include "device/vr/public/cpp/vr_device_provider.h"
#include "device/vr/vr_export.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/device/public/mojom/sensor_provider.mojom.h"
namespace device {
class DEVICE_VR_EXPORT VROrientationDeviceProvider : public VRDeviceProvider {
class COMPONENT_EXPORT(VR_ORIENTATION) VROrientationDeviceProvider
: public VRDeviceProvider {
public:
explicit VROrientationDeviceProvider(
mojo::PendingRemote<device::mojom::SensorProvider> sensor_provider);

@ -7,17 +7,15 @@
#include <memory>
#include "base/component_export.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "device/vr/public/mojom/isolated_xr_service.mojom.h"
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "device/vr/vr_device.h"
#include "device/vr/vr_export.h"
#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "ui/display/display.h"
namespace device {
@ -27,7 +25,7 @@ class VROrientationDevice;
// that exposes device orientation sensors.
// VROrientationSession objects are owned by their respective
// VROrientationDevice instances.
class DEVICE_VR_EXPORT VROrientationSession
class COMPONENT_EXPORT(VR_ORIENTATION) VROrientationSession
: public mojom::XRFrameDataProvider,
public mojom::XRSessionController {
public:

@ -6,10 +6,10 @@
#define DEVICE_VR_VR_DEVICE_H
#include "base/callback.h"
#include "base/component_export.h"
#include "base/macros.h"
#include "device/vr/public/mojom/isolated_xr_service.mojom.h"
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "device/vr/vr_export.h"
namespace device {
@ -29,8 +29,8 @@ enum class VrViewerType {
OPENXR_UNKNOWN = 70, // Going through OpenXR APIs
};
void LogViewerType(VrViewerType); // Implemented in vr_device_base.cc
// Implemented in vr_device_base.cc
void COMPONENT_EXPORT(DEVICE_VR_BASE) LogViewerType(VrViewerType);
} // namespace device
#endif // DEVICE_VR_VR_DEVICE_H

@ -9,22 +9,20 @@
#include <vector>
#include "base/callback.h"
#include "base/component_export.h"
#include "base/macros.h"
#include "device/vr/public/mojom/vr_service.mojom.h"
#include "device/vr/vr_device.h"
#include "device/vr/vr_export.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_associated_remote.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "ui/display/display.h"
namespace device {
// Represents one of the platform's VR devices. Owned by the respective
// VRDeviceProvider.
// TODO(mthiesse, crbug.com/769373): Remove DEVICE_VR_EXPORT.
class DEVICE_VR_EXPORT VRDeviceBase : public mojom::XRRuntime {
class COMPONENT_EXPORT(DEVICE_VR_BASE) VRDeviceBase : public mojom::XRRuntime {
public:
explicit VRDeviceBase(mojom::XRDeviceId id);
~VRDeviceBase() override;