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

Unified Diff: gpu/config/gpu_info_collector_android.cc

Issue 1656223003: command_buffer_gles2: Avoid crashing for lack of JNI (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/config/gpu_info_collector_android.cc
diff --git a/gpu/config/gpu_info_collector_android.cc b/gpu/config/gpu_info_collector_android.cc
index de964e2c77147a45ba22abe767d7c22d4ae0c6af..28f5447296cbc86974f87c516cc78376568ad752 100644
--- a/gpu/config/gpu_info_collector_android.cc
+++ b/gpu/config/gpu_info_collector_android.cc
@@ -8,6 +8,7 @@
#include <stdint.h>
#include "base/android/build_info.h"
+#include "base/android/jni_android.h"
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
@@ -265,8 +266,12 @@ CollectInfoResult CollectGpuID(uint32_t* vendor_id, uint32_t* device_id) {
CollectInfoResult CollectBasicGraphicsInfo(GPUInfo* gpu_info) {
gpu_info->can_lose_context = false;
- gpu_info->machine_model_name =
- base::android::BuildInfo::GetInstance()->model();
+ // When command buffer is compiled as a standalone library, the process might
+ // not have a Java environment.
+ if (base::android::IsVMInitialized()) {
+ gpu_info->machine_model_name =
+ base::android::BuildInfo::GetInstance()->model();
+ }
// Create a short-lived context on the UI thread to collect the GL strings.
// Make sure we restore the existing context if there is one.
« 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