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

Unified Diff: device/vr/vr_display_impl.cc

Issue 2658643003: Refactor GvrDelegate ownership into GvrDelegateProvider and fix more threading violations. (Closed)
Patch Set: Address comments Created 3 years, 11 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 | « device/vr/vr_display_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/vr_display_impl.cc
diff --git a/device/vr/vr_display_impl.cc b/device/vr/vr_display_impl.cc
index c99b7dfc813f07ffa82f762cf81813accf699059..c14f8b736beecd8644d52d5101786ec48e25ca32 100644
--- a/device/vr/vr_display_impl.cc
+++ b/device/vr/vr_display_impl.cc
@@ -15,11 +15,17 @@ VRDisplayImpl::VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service)
device_(device),
service_(service),
weak_ptr_factory_(this) {
- mojom::VRDisplayInfoPtr display_info = device->GetVRDevice();
- if (service->client()) {
- service->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(),
- mojo::MakeRequest(&client_),
- std::move(display_info));
+ base::Callback<void(mojom::VRDisplayInfoPtr)> callback = base::Bind(
+ &VRDisplayImpl::OnVRDisplayInfoCreated, weak_ptr_factory_.GetWeakPtr());
+ device->GetVRDevice(callback);
+}
+
+void VRDisplayImpl::OnVRDisplayInfoCreated(
+ mojom::VRDisplayInfoPtr display_info) {
+ if (service_->client()) {
+ service_->client()->OnDisplayConnected(binding_.CreateInterfacePtrAndBind(),
+ mojo::MakeRequest(&client_),
+ std::move(display_info));
}
}
« no previous file with comments | « device/vr/vr_display_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698