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

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

Issue 2471433002: Implement WebVR presentation pausing for VR Shell Menu Mode (Closed)
Patch Set: rebase Created 4 years, 1 month 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 be3d657764f9e225620d4fe22dca6cb6b5c1d545..b82dc31dc1ace727ded8e9e6094c6993d883cdff 100644
--- a/device/vr/android/gvr/gvr_device.cc
+++ b/device/vr/android/gvr/gvr_device.cc
@@ -10,6 +10,7 @@
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "device/vr/android/gvr/gvr_delegate.h"
+#include "device/vr/android/gvr/gvr_device_provider.h"
#include "device/vr/vr_device_manager.h"
#include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr.h"
#include "third_party/gvr-android-sdk/src/ndk/include/vr/gvr/capi/include/gvr_types.h"
@@ -24,8 +25,9 @@ static const uint64_t kPredictionTimeWithoutVsyncNanos = 50000000;
} // namespace
-GvrDevice::GvrDevice(GvrDeviceProvider* provider, GvrDelegate* delegate)
- : VRDevice(provider), delegate_(delegate), gvr_provider_(provider) {}
+GvrDevice::GvrDevice(GvrDeviceProvider* provider,
+ const base::WeakPtr<GvrDelegate>& delegate)
+ : VRDevice(), delegate_(delegate), gvr_provider_(provider) {}
GvrDevice::~GvrDevice() {}
@@ -153,6 +155,9 @@ mojom::VRPosePtr GvrDevice::GetPose(VRServiceImpl* service) {
return pose;
}
+ if (!delegate_)
+ return nullptr;
+
gvr::ClockTimePoint target_time = gvr::GvrApi::GetTimePointNow();
target_time.monotonic_system_time_nanos += kPredictionTimeWithoutVsyncNanos;
@@ -245,7 +250,7 @@ void GvrDevice::UpdateLayerBounds(VRServiceImpl* service,
rightBounds->width, rightBounds->height);
}
-void GvrDevice::SetDelegate(GvrDelegate* delegate) {
+void GvrDevice::SetDelegate(const base::WeakPtr<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