Index: content/app/android/child_process_service.cc |
diff --git a/content/app/android/child_process_service.cc b/content/app/android/child_process_service.cc |
index 0a78803c026af47bac21374a1a16cceb9ed51f1a..62c04d6623eb179a6d7b7103e614a97839042f46 100644 |
--- a/content/app/android/child_process_service.cc |
+++ b/content/app/android/child_process_service.cc |
@@ -72,8 +72,12 @@ class SurfaceTexturePeerChildImpl : public SurfaceTexturePeer, |
if (surface.j_surface().is_null()) |
return NULL; |
- ANativeWindow* native_window = ANativeWindow_fromSurface( |
- env, surface.j_surface().obj()); |
+ // Note: This ensures that any local references used by |
+ // ANativeWindow_fromSurface are released immediately. This is needed as a |
+ // workaround for https://code.google.com/p/android/issues/detail?id=68174 |
+ base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); |
+ ANativeWindow* native_window = |
+ ANativeWindow_fromSurface(env, surface.j_surface().obj()); |
return native_window; |
} |
@@ -90,6 +94,10 @@ class SurfaceTexturePeerChildImpl : public SurfaceTexturePeer, |
if (surface.j_surface().is_null()) |
return NULL; |
+ // Note: This ensures that any local references used by |
+ // ANativeWindow_fromSurface are released immediately. This is needed as a |
+ // workaround for https://code.google.com/p/android/issues/detail?id=68174 |
+ base::android::ScopedJavaLocalFrame scoped_local_reference_frame(env); |
ANativeWindow* native_window = |
ANativeWindow_fromSurface(env, surface.j_surface().obj()); |