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

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: rebase 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 770c0062d4e10aa4b5496940fba32e1027cc94b2..a80762c971e31b817680bdcfa1f5e61b44a6e2c4 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -87,6 +87,8 @@
#include "content/common/sandbox_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
@@ -374,6 +376,9 @@ void RenderMessageFilter::OnChannelClosing() {
}
#endif // defined(ENABLE_PLUGINS)
plugin_host_clients_.clear();
+#if defined(OS_ANDROID)
+ CompositorImpl::DestroyAllSurfaceTextures(render_process_id_);
+#endif
}
void RenderMessageFilter::OnChannelConnected(int32 peer_id) {
@@ -1300,6 +1305,22 @@ void RenderMessageFilter::OnAllocateGpuMemoryBuffer(
}
#endif
+#if defined(OS_ANDROID)
+ if (GpuMemoryBufferImplSurfaceTexture::IsFormatSupported(internalformat)) {
+ // Each surface texture is associated with a render process id. 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::CreateSurfaceTexture(render_process_id_);
+ if (surface_texture_id != -1) {
+ handle->type = gfx::SURFACE_TEXTURE_BUFFER;
+ handle->surface_texture_id =
+ gfx::SurfaceTextureId(surface_texture_id, render_process_id_);
+ return;
+ }
+ }
+#endif
+
uint64 stride = static_cast<uint64>(width) *
GpuMemoryBufferImpl::BytesPerPixel(internalformat);
if (stride > std::numeric_limits<uint32>::max()) {
« no previous file with comments | « content/browser/renderer_host/compositor_impl_android.cc ('k') | content/common/android/surface_texture_lookup.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698