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

Unified Diff: device/vr/android/gvr/gvr_device.cc

Issue 2570553004: Clean up some VrShell threading issues and remove unnecessary WeakPtr types. (Closed)
Patch Set: rebase Created 4 years 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/android/gvr/gvr_device.h ('k') | device/vr/android/gvr/gvr_device_provider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/android/gvr/gvr_device.cc
diff --git a/device/vr/android/gvr/gvr_device.cc b/device/vr/android/gvr/gvr_device.cc
index eb299f5ef7f418d4d19f368fb4bc6e439de0393d..426b8cf43b522e55c35319306e03806fc263cce0 100644
--- a/device/vr/android/gvr/gvr_device.cc
+++ b/device/vr/android/gvr/gvr_device.cc
@@ -25,8 +25,7 @@ static const uint64_t kPredictionTimeWithoutVsyncNanos = 50000000;
} // namespace
-GvrDevice::GvrDevice(GvrDeviceProvider* provider,
- const base::WeakPtr<GvrDelegate>& delegate)
+GvrDevice::GvrDevice(GvrDeviceProvider* provider, GvrDelegate* delegate)
: VRDevice(), delegate_(delegate), gvr_provider_(provider) {}
GvrDevice::~GvrDevice() {}
@@ -91,8 +90,10 @@ mojom::VRDisplayInfoPtr GvrDevice::GetVRDevice() {
// Tell the delegate not to draw yet, to avoid a race condition
// (and visible wobble) on entering VR.
- delegate_->SetWebVRRenderSurfaceSize(kInvalidRenderTargetSize.width,
- kInvalidRenderTargetSize.height);
+ if (delegate_) {
+ delegate_->SetWebVRRenderSurfaceSize(kInvalidRenderTargetSize.width,
+ kInvalidRenderTargetSize.height);
+ }
return device;
}
@@ -141,8 +142,10 @@ mojom::VRDisplayInfoPtr GvrDevice::GetVRDevice() {
right_eye->offset[1] = -right_eye_mat.m[1][3];
right_eye->offset[2] = -right_eye_mat.m[2][3];
- delegate_->SetWebVRRenderSurfaceSize(2 * left_eye->renderWidth,
- left_eye->renderHeight);
+ if (delegate_) {
+ delegate_->SetWebVRRenderSurfaceSize(2 * left_eye->renderWidth,
+ left_eye->renderHeight);
+ }
return device;
}
@@ -258,7 +261,7 @@ void GvrDevice::UpdateLayerBounds(mojom::VRLayerBoundsPtr left_bounds,
delegate_->UpdateWebVRTextureBounds(left_gvr_bounds, right_gvr_bounds);
}
-void GvrDevice::SetDelegate(const base::WeakPtr<GvrDelegate>& delegate) {
+void GvrDevice::SetDelegate(GvrDelegate* delegate) {
delegate_ = delegate;
// Notify the clients that this device has changed
« no previous file with comments | « device/vr/android/gvr/gvr_device.h ('k') | device/vr/android/gvr/gvr_device_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698