Index: content/browser/renderer_host/render_message_filter.cc |
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc |
index 958b491496129debfaf49b0cc2a91547eac1c07b..8b556a2eedb2d7c3d38e147dbbf41f313964e549 100644 |
--- a/content/browser/renderer_host/render_message_filter.cc |
+++ b/content/browser/renderer_host/render_message_filter.cc |
@@ -86,6 +86,8 @@ |
#include "content/common/font_cache_dispatcher_win.h" |
#endif |
#if defined(OS_ANDROID) |
+#include "content/browser/renderer_host/compositor_impl_android.h" |
+#include "content/common/gpu/client/gpu_memory_buffer_impl_surface_texture.h" |
#include "media/base/android/webaudio_media_codec_bridge.h" |
#endif |
@@ -373,6 +375,9 @@ void RenderMessageFilter::OnChannelClosing() { |
} |
#endif // defined(ENABLE_PLUGINS) |
plugin_host_clients_.clear(); |
+#if defined(OS_ANDROID) |
+ CompositorImpl::DestroyAllSurfaceTextures(PeerHandle()); |
+#endif |
} |
void RenderMessageFilter::OnChannelConnected(int32 peer_id) { |
@@ -1298,6 +1303,22 @@ void RenderMessageFilter::OnAllocateGpuMemoryBuffer( |
} |
#endif |
+#if defined(OS_ANDROID) |
+ if (GpuMemoryBufferImplSurfaceTexture::IsFormatSupported(internalformat)) { |
+ // Each surface texture is associated with a PeerHandle(). This allows the |
+ // GPU service and Java Binder IPC to verify that a renderer is not trying |
+ // to use a surface texture it doesn't own. |
+ int surface_texture_id = |
+ CompositorImpl::AllocateSurfaceTexture(PeerHandle()); |
+ if (surface_texture_id != -1) { |
+ handle->type = gfx::SURFACE_TEXTURE_BUFFER; |
+ handle->surface_texture_id = |
+ gfx::SurfaceTextureId(surface_texture_id, PeerHandle()); |
+ return; |
+ } |
+ } |
+#endif |
+ |
uint64 stride = static_cast<uint64>(width) * |
GpuMemoryBufferImpl::BytesPerPixel(internalformat); |
if (stride > std::numeric_limits<uint32>::max()) { |