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

Unified Diff: content/common/android/surface_texture_bridge.cc

Issue 11787031: Fix hang in Android WebView release build tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Factor out check and add LOG(WARNING) when fails. Created 7 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 | « android_webview/native/aw_contents.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/android/surface_texture_bridge.cc
diff --git a/content/common/android/surface_texture_bridge.cc b/content/common/android/surface_texture_bridge.cc
index bdf54eeb0a2a6dd88ae2f3c59837fcf4e42670b6..eb4b27ebc78d12cc2289a4b7eb76e27f835d598f 100644
--- a/content/common/android/surface_texture_bridge.cc
+++ b/content/common/android/surface_texture_bridge.cc
@@ -6,6 +6,8 @@
#include <android/native_window_jni.h>
+// TODO(boliu): Remove this include when we move off ICS.
+#include "base/android/build_info.h"
#include "base/android/jni_android.h"
#include "base/logging.h"
#include "content/common/android/surface_texture_listener.h"
@@ -27,6 +29,16 @@ void RegisterNativesIfNeeded(JNIEnv* env) {
g_jni_initialized = true;
}
}
+
+// TODO(boliu): Remove this method when when we move off ICS. See
+// http://crbug.com/161864.
+bool GlContextMethodsAvailable() {
+ bool available = base::android::BuildInfo::GetInstance()->sdk_int() >= 16;
+ if (!available)
+ LOG(WARNING) << "Running on unsupported device: rendering may not work";
+ return available;
+}
+
} // namespace
namespace content {
@@ -108,17 +120,21 @@ void SurfaceTextureBridge::SetDefaultBufferSize(int width, int height) {
}
void SurfaceTextureBridge::AttachToGLContext(int texture_id) {
- JNIEnv* env = AttachCurrentThread();
- // Note: This method is only available on JB and greater.
- JNI_SurfaceTexture::Java_SurfaceTexture_attachToGLContext(
- env, j_surface_texture_.obj(), texture_id);
+ if (GlContextMethodsAvailable()) {
+ JNIEnv* env = AttachCurrentThread();
+ // Note: This method is only available on JB and greater.
+ JNI_SurfaceTexture::Java_SurfaceTexture_attachToGLContext(
+ env, j_surface_texture_.obj(), texture_id);
+ }
}
void SurfaceTextureBridge::DetachFromGLContext() {
- JNIEnv* env = AttachCurrentThread();
- // Note: This method is only available on JB and greater.
- JNI_SurfaceTexture::Java_SurfaceTexture_detachFromGLContext(
- env, j_surface_texture_.obj());
+ if (GlContextMethodsAvailable()) {
+ JNIEnv* env = AttachCurrentThread();
+ // Note: This method is only available on JB and greater.
+ JNI_SurfaceTexture::Java_SurfaceTexture_detachFromGLContext(
+ env, j_surface_texture_.obj());
+ }
}
ANativeWindow* SurfaceTextureBridge::CreateSurface() {
« no previous file with comments | « android_webview/native/aw_contents.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698