Skip to content

Commit

Permalink
Add additional check to block race condition
Browse files Browse the repository at this point in the history
It is possible, though unlikely, for a second request to come through
*after* a request has been served (e.g. the runtime is presenting and
the request_session_callback_ has been nulled out). This request should
be rejected as there is now an active immersive session; though the
browser process may not know it yet. (e.g. the request got queued up
while the previous request was processing and so the browser process
was as yet unaware of the result).

Fixed: 1450601
Change-Id: Ifbad64e0f3221e3068690879d6c120347e8163a7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4592111
Auto-Submit: Alexander Cooper <alcooper@chromium.org>
Commit-Queue: Alexander Cooper <alcooper@chromium.org>
Reviewed-by: Brandon Jones <bajones@chromium.org>
Commit-Queue: Brandon Jones <bajones@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1153592}
  • Loading branch information
alcooper91 authored and Chromium LUCI CQ committed Jun 6, 2023
1 parent 7c615e3 commit 152f1a2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion device/vr/openxr/openxr_device.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void OpenXrDevice::RequestSession(
mojom::XRRuntime::RequestSessionCallback callback) {
// TODO(https://crbug.com/1450707): Strengthen the guarantees from the browser
// process that we will not get a session request while one is pending.
if (request_session_callback_) {
if (request_session_callback_ || HasExclusiveSession()) {
LOG(ERROR) << __func__
<< " New session request while processing previous request.";
std::move(callback).Run(nullptr);
Expand Down

0 comments on commit 152f1a2

Please sign in to comment.