Index: content/browser/renderer_host/compositor_impl_android.cc |
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc |
index db02a7c656a49acc3e231a7eef08414ea69c2b69..c472607b5061cac9819f57974a1d16b2f9883e72 100644 |
--- a/content/browser/renderer_host/compositor_impl_android.cc |
+++ b/content/browser/renderer_host/compositor_impl_android.cc |
@@ -361,8 +361,13 @@ void CompositorImpl::SetSurface(jobject surface) { |
// Now, set the new surface if we have one. |
ANativeWindow* window = NULL; |
- if (surface) |
+ if (surface) { |
+ // 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); |
window = ANativeWindow_fromSurface(env, surface); |
+ } |
if (window) { |
SetWindowSurface(window); |
ANativeWindow_release(window); |