Commit 7e906a68 authored by David Dorwin's avatar David Dorwin Committed by Commit Bot

Remove RequestSession()'s triggered_by_displayactive

This affects metrics in one case for WebVR: WebVR presentation sessions
started by headset activation will be counted as requestPresent.
This seems like a reasonable tradeoff for this simplification since
WebVR is deprecated and such scenarios are likely rare.

The use in VRDisplay's constructor was not actually necessary since
this is a non-immersive session.

Bug: 842025
Change-Id: I08d4712967c1ce2720e93f85d7679a2f915a6b65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1629178Reviewed-by: default avatarBill Orr <billorr@chromium.org>
Reviewed-by: default avatarKlaus Weidner <klausw@chromium.org>
Reviewed-by: default avatarDaniel Cheng <dcheng@chromium.org>
Commit-Queue: David Dorwin <ddorwin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664109}
parent 83b82e46
......@@ -110,7 +110,6 @@ XRDeviceImpl::~XRDeviceImpl() {
void XRDeviceImpl::RequestSession(
device::mojom::XRSessionOptionsPtr options,
bool triggered_by_displayactive,
device::mojom::XRDevice::RequestSessionCallback callback) {
DCHECK(options);
......@@ -140,18 +139,16 @@ void XRDeviceImpl::RequestSession(
GetWebContents(),
base::BindOnce(&XRDeviceImpl::OnUserConsent,
weak_ptr_factory_.GetWeakPtr(), std::move(options),
triggered_by_displayactive, std::move(callback)));
std::move(callback)));
return;
}
#endif
OnUserConsent(std::move(options), triggered_by_displayactive,
std::move(callback), true);
OnUserConsent(std::move(options), std::move(callback), true);
}
void XRDeviceImpl::OnUserConsent(
device::mojom::XRSessionOptionsPtr options,
bool triggered_by_displayactive,
device::mojom::XRDevice::RequestSessionCallback callback,
bool allowed) {
if (!allowed) {
......@@ -184,9 +181,7 @@ void XRDeviceImpl::OnUserConsent(
render_frame_host_ ? render_frame_host_->GetRoutingID() : -1;
if (runtime_options->immersive) {
if (!triggered_by_displayactive) {
ReportRequestPresent();
}
ReportRequestPresent();
base::OnceCallback<void(device::mojom::XRSessionPtr)> immersive_callback =
base::BindOnce(&XRDeviceImpl::OnSessionCreated,
......
......@@ -39,7 +39,6 @@ class XRDeviceImpl : public device::mojom::XRDevice {
// device::mojom::XRDevice
void RequestSession(
device::mojom::XRSessionOptionsPtr options,
bool triggered_by_displayactive,
device::mojom::XRDevice::RequestSessionCallback callback) override;
void SupportsSession(
device::mojom::XRSessionOptionsPtr options,
......@@ -84,7 +83,6 @@ class XRDeviceImpl : public device::mojom::XRDevice {
device::mojom::XRDevice::RequestSessionCallback callback,
device::mojom::XRSessionPtr session);
void OnUserConsent(device::mojom::XRSessionOptionsPtr options,
bool triggered_by_displayactive,
device::mojom::XRDevice::RequestSessionCallback callback,
bool allowed);
......
......@@ -348,9 +348,7 @@ interface VRServiceClient {
interface XRDevice {
// Request to initialize a session in the browser process. If successful, the
// XRSession struct with the requisite interfaces will be returned.
RequestSession(
XRSessionOptions options,
bool triggered_by_displayactive) => (XRSession? session);
RequestSession(XRSessionOptions options) => (XRSession? session);
SupportsSession(XRSessionOptions options) => (bool supports_session);
// WebVR 1.1 functionality compatibility method. Returns VRDisplayInfo for an
......
......@@ -150,12 +150,8 @@ VRDisplay::VRDisplay(NavigatorVR* navigator_vr,
device::mojom::blink::XRSessionOptionsPtr options =
device::mojom::blink::XRSessionOptions::New();
options->immersive = false;
// Set in_on_display_activate to true, this will prevent the request present
// from being logged.
// TODO(http://crbug.com/842025): clean up the logging when refactors are
// complete.
device_ptr_->RequestSession(
std::move(options), true,
std::move(options),
WTF::Bind(&VRDisplay::OnNonImmersiveSessionRequestReturned,
WrapPersistent(this)));
}
......@@ -549,7 +545,7 @@ ScriptPromise VRDisplay::requestPresent(
options->use_legacy_webvr_render_path = true;
device_ptr_->RequestSession(
std::move(options), in_display_activate_,
std::move(options),
WTF::Bind(&VRDisplay::OnRequestImmersiveSessionReturned,
WrapPersistent(this)));
pending_present_request_ = true;
......@@ -979,8 +975,6 @@ void VRDisplay::OnActivate(device::mojom::blink::VRDisplayEventReason reason,
if (reason == device::mojom::blink::VRDisplayEventReason::MOUNTED)
gesture_indicator = LocalFrame::NotifyUserActivation(doc->GetFrame());
base::AutoReset<bool> in_activate(&in_display_activate_, true);
navigator_vr_->DispatchVREvent(VRDisplayEvent::Create(
event_type_names::kVrdisplayactivate, this, reason));
std::move(on_handled).Run(!pending_present_request_ && !is_presenting_);
......
......@@ -354,7 +354,7 @@ void XR::DispatchRequestSession(PendingSessionQuery* query) {
// legacy API has been removed.
outstanding_request_queries_.insert(query);
device_->RequestSession(
std::move(session_options), false /* triggered by display activate */,
std::move(session_options),
WTF::Bind(&XR::OnRequestSessionReturned, WrapWeakPersistent(this),
WrapPersistent(query)));
}
......
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