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

Unified Diff: content/browser/renderer_host/render_message_filter.cc

Issue 195583003: Add initial GpuMemoryBufferSurfaceTexture implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: use base::ProcessHandle explicitly in a few places Created 6 years, 9 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
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()) {

Powered by Google App Engine
This is Rietveld 408576698