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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java

Issue 2744623002: Fix x86 VrShellDelegate crash (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
index 2c36264b3ed909097c43aef7faeb8855c8096c2a..47a98fe36484764005db5b96d6e96961014829aa 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellDelegate.java
@@ -115,6 +115,10 @@ public class VrShellDelegate {
* Called when the native library is first available.
*/
public static void onNativeLibraryAvailable() {
+ // Check if VR classes are available before trying to use them. Note that the native
+ // vr_shell_delegate.cc is compiled out of unsupported platforms (like x86).
+ VrClassesWrapper wrapper = getVrClassesWrapper();
+ if (wrapper == null) return;
nativeOnLibraryAvailable();
}
@@ -234,7 +238,9 @@ public class VrShellDelegate {
if (!LibraryLoader.isInitialized()) return null;
// Note that we only support ChromeTabbedActivity for now.
if (activity == null || !(activity instanceof ChromeTabbedActivity)) return null;
- sInstance = new VrShellDelegate((ChromeActivity) activity);
+ VrClassesWrapper wrapper = getVrClassesWrapper();
+ if (wrapper == null) return null;
+ sInstance = new VrShellDelegate((ChromeActivity) activity, wrapper);
return sInstance;
}
@@ -308,9 +314,9 @@ public class VrShellDelegate {
return ChromeFeatureList.isEnabled(ChromeFeatureList.VR_SHELL);
}
- private VrShellDelegate(ChromeActivity activity) {
+ private VrShellDelegate(ChromeActivity activity, VrClassesWrapper wrapper) {
mActivity = activity;
- mVrClassesWrapper = createVrClassesWrapper();
+ mVrClassesWrapper = wrapper;
updateVrSupportLevel();
mNativeVrShellDelegate = nativeInit();
Choreographer choreographer = Choreographer.getInstance();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698