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

Unified Diff: chrome/browser/android/vr_shell/vr_shell_gl.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 | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | device/vr/android/gvr/gvr_delegate.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/vr_shell/vr_shell_gl.cc
diff --git a/chrome/browser/android/vr_shell/vr_shell_gl.cc b/chrome/browser/android/vr_shell/vr_shell_gl.cc
index 78bc7f8c5007445c4131c3434717d8352f63fb0c..55a45192759441f8afdc0679bb2e433c109d8ec3 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -154,6 +154,12 @@ int64_t TimeInMicroseconds() {
std::chrono::steady_clock::now().time_since_epoch()).count();
}
+void RunVRDisplayInfoCallback(
+ const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+ device::mojom::VRDisplayInfoPtr info) {
+ callback.Run(std::move(info));
+}
+
} // namespace
VrShellGl::VrShellGl(
@@ -946,10 +952,6 @@ void VrShellGl::UpdateWebVRTextureBounds(int16_t frame_index,
}
}
-gvr::GvrApi* VrShellGl::gvr_api() {
- return gvr_api_.get();
-}
-
void VrShellGl::ContentBoundsChanged(int width, int height) {
TRACE_EVENT0("gpu", "VrShellGl::ContentBoundsChanged");
content_tex_css_width_ = width;
@@ -1057,4 +1059,21 @@ void VrShellGl::SendVSync(base::TimeDelta time,
callback.Run(VrShell::VRPosePtrFromGvrPose(head_mat), time, frame_index);
}
+void VrShellGl::ResetPose() {
+ // Should never call RecenterTracking when using with Daydream viewers. On
+ // those devices recentering should only be done via the controller.
+ if (gvr_api_ && gvr_api_->GetViewerType() == GVR_VIEWER_TYPE_CARDBOARD)
+ gvr_api_->RecenterTracking();
+}
+
+void VrShellGl::CreateVRDisplayInfo(
+ const base::Callback<void(device::mojom::VRDisplayInfoPtr)>& callback,
+ uint32_t device_id) {
+ device::mojom::VRDisplayInfoPtr info = VrShell::CreateVRDisplayInfo(
+ gvr_api_.get(), content_tex_physical_size_, device_id);
+ main_thread_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&RunVRDisplayInfoCallback, callback, base::Passed(&info)));
+}
+
} // namespace vr_shell
« no previous file with comments | « chrome/browser/android/vr_shell/vr_shell_gl.h ('k') | device/vr/android/gvr/gvr_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698