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

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

Issue 2513143002: Fixed crash when exiting page using GVR controller w/ the gamepad API (Closed)
Patch Set: 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_gamepad_data_fetcher.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
diff --git a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
index 219897a60bc8a0a15bbe6f11ccf5b7289bd3cf0d..9f7f391952872f3472d577d5d46c67a675fc94a6 100644
--- a/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
+++ b/device/vr/android/gvr/gvr_gamepad_data_fetcher.cc
@@ -57,7 +57,8 @@ GvrGamepadDataFetcher::GvrGamepadDataFetcher(GvrDelegate* delegate,
if (!success)
controller_api_.reset(nullptr);
- user_prefs_.reset(new gvr::UserPrefs(gvr_api->GetUserPrefs().cobj()));
billorr 2016/11/18 22:27:52 I assume the bug is that the user_prefs_ object go
+ // TODO(bajones): Monitor changes to the controller handedness.
+ handedness_ = gvr_api->GetUserPrefs().GetControllerHandedness();
}
GvrGamepadDataFetcher::~GvrGamepadDataFetcher() {}
@@ -91,17 +92,15 @@ void GvrGamepadDataFetcher::GetGamepadData(bool devices_changed_hint) {
pad.axesLength = 2;
pad.displayId = display_id_;
+
+ pad.hand = (handedness_ == GVR_CONTROLLER_RIGHT_HANDED) ? GamepadHandRight
+ : GamepadHandLeft;
}
controller_state_.Update(*controller_api_);
pad.timestamp = controller_state_.GetLastOrientationTimestamp();
- // TODO: Query from API if avaialable.
- gvr::ControllerHandedness handedness = user_prefs_->GetControllerHandedness();
- pad.hand = (handedness == GVR_CONTROLLER_RIGHT_HANDED) ? GamepadHandRight
- : GamepadHandLeft;
-
if (controller_state_.IsTouching()) {
gvr_vec2f touch_position = controller_state_.GetTouchPos();
pad.axes[0] = (touch_position.x * 2.0f) - 1.0f;
« no previous file with comments | « device/vr/android/gvr/gvr_gamepad_data_fetcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698