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).

(cherry picked from commit 152f1a2)

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-Original-Commit-Position: refs/heads/main@{#1153592}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4600676
Commit-Queue: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Cr-Commit-Position: refs/branch-heads/5790@{#496}
Cr-Branched-From: 1d71a33-refs/heads/main@{#1148114}
  • Loading branch information
alcooper91 authored and Chromium LUCI CQ committed Jun 8, 2023
1 parent 878dc3a commit f669cac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion device/vr/openxr/openxr_device.cc
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 f669cac

Please sign in to comment.