1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108

content / browser / xr / webxr_internals / mojom / webxr_internals.mojom [blame]

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

module webxr.mojom;

import "device/vr/public/mojom/xr_device.mojom";
import "device/vr/public/mojom/xr_session.mojom";
import "mojo/public/mojom/base/time.mojom";

// Human readable information about the device
struct DeviceInfo {
    string operating_system_name;
    string operating_system_version;
    string gpu_gl_vendor;
    string gpu_gl_renderer;
};

// Human readable information about the session requested record.
struct SessionRequestedRecord {
    device.mojom.XRSessionOptions options;
    mojo_base.mojom.Time requested_time;
};

// Human readable information about the session rejected record.
struct SessionRejectedRecord {
    // ID of this request, used for tracing.
    uint64 trace_id;
    device.mojom.RequestSessionError failure_reason;
    mojo_base.mojom.Time rejected_time;
    string failure_reason_description;
    array<device.mojom.XRSessionFeature> rejected_features;
};

// Human readable information about the session started record.
struct SessionStartedRecord {
    // ID of this request, used for tracing.
    uint64 trace_id;
    device.mojom.XRDeviceId device_id;
    mojo_base.mojom.Time started_time;
};

// Human readable information about the session stopped record.
struct SessionStoppedRecord {
    // ID of this request, used for tracing.
    uint64 trace_id;
    mojo_base.mojom.Time stopped_time;
};

// Human readable information about the runtime info.
// Note: We don't use device.mojom.XRDeviceData here due to conflicts with
// building the luid for WebUI. Instead, we create RuntimeInfo without
// specifying the luid.
struct RuntimeInfo {
    device.mojom.XRDeviceId device_id;
    array<device.mojom.XRSessionFeature> supported_features;
    bool is_ar_blend_mode_supported;
};

// Interface for controlling WebXR Internals.
// Handles requests from "chrome://webxr-internals"
// This is expected to be hosted in the browser process and is used from the
// WebUI renderer.
interface WebXrInternalsHandler {
    // Returns information about the operating system name,
    // operating system version, GPU driver and GPU vendor ID.
    GetDeviceInfo() => (DeviceInfo device_info);

    // Returns information about active runtimes, including:
    // Device ID, Supported Features and the runtime supports AR or not.
    GetActiveRuntimes() => (array<RuntimeInfo> active_runtimes);

    // Subscribes to events with a pending remote XrInternalsSessionListener
    SubscribeToEvents(pending_remote<XRInternalsSessionListener> listener);
};

// Used by webxr internals WebUI to query browser process about session
// events.
interface XRInternalsSessionListener {
    // Begin listening for updates to log session requested record.
    LogXrSessionRequested(SessionRequestedRecord session_requested_record);

    // Begin listening for updates to log session rejected record.
    LogXrSessionRejected(SessionRejectedRecord session_rejected_record);

    // Begin listening for updates to log session started record.
    LogXrSessionStarted(SessionStartedRecord session_started_record);

    // Begin listening for updates to log session stopped record.
    LogXrSessionStopped(SessionStoppedRecord session_stopped_record);

    // Begin listening for updates to log runtime added record.
    // This method does not send historical data.
    LogXrRuntimeAdded(RuntimeInfo runtime_added_record);

    // Begin listening for updates to log runtime removed
    // for the specified XR device.
    // This method does not send historical data.
    LogXrRuntimeRemoved(device.mojom.XRDeviceId device_id);

    // Begin listening for incoming frames for diagnostics calculation.
    // This method does not send historical data.
    LogFrameData(device.mojom.XrFrameStatistics xrframe_statistics);

    // Begin listening for incoming console messages for diagnostics.
    // This method does not send historical data.
    LogConsoleMessages(device.mojom.XrLogMessage xrlogging_statistics);
};