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

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: cleanup 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
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 5becab650c9007cc66d219250d18a02775c8b3d3..a3e9407e158482e0e22be7eec3422fb6c1336ada 100644
--- a/chrome/browser/android/vr_shell/vr_shell_gl.cc
+++ b/chrome/browser/android/vr_shell/vr_shell_gl.cc
@@ -153,6 +153,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(
@@ -935,10 +941,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;
@@ -1047,4 +1049,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

Powered by Google App Engine
This is Rietveld 408576698