Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2418)

Unified Diff: device/vr/vr_service_impl.cc

Issue 2773223002: Fixes crash where the browser crashed when visiting WebVR pages without VR Services installed. (Closed)
Patch Set: Added comment for clarification Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_service_impl.cc
diff --git a/device/vr/vr_service_impl.cc b/device/vr/vr_service_impl.cc
index 05b75b07221d06b45bbbbd7a4705902fad213047..b22959aed5736b5856d524955d0dc6ca5fc4d686 100644
--- a/device/vr/vr_service_impl.cc
+++ b/device/vr/vr_service_impl.cc
@@ -36,8 +36,8 @@ void VRServiceImpl::SetClient(mojom::VRServiceClientPtr service_client,
client_ = std::move(service_client);
VRDeviceManager* device_manager = VRDeviceManager::GetInstance();
// Once a client has been connected AddService will force any VRDisplays to
- // send OnConnected to it so that it's populated with the currently active
- // displays. Thereafer it will stay up to date by virtue of listening for new
+ // send ConnectDevice to it so that it's populated with the currently active
+ // displays. Thereafter it will stay up to date by virtue of listening for new
// connected events.
device_manager->AddService(this);
callback.Run(device_manager->GetNumberOfConnectedDevices());
@@ -69,6 +69,12 @@ void VRServiceImpl::OnVRDisplayInfoCreated(
"process is not established";
return;
}
+ if (!display_info) {
+ // If we get passed a null display info it means the device does not exist.
+ // This can happen for example if VR services are not installed. We will not
+ // instantiate a display in this case.
+ return;
+ }
displays_[device] = base::MakeUnique<VRDisplayImpl>(
device, this, client_.get(), std::move(display_info));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698