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

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

Issue 255713008: Change glimage to accept a type. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 7 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
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/common/child_process_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 c5eed716df1c3f21b0a0f300e9f6a7a846406f5f..a9b050674329cc814003f5161350deab03f012ae 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -35,6 +35,7 @@
#include "content/common/desktop_notification_messages.h"
#include "content/common/frame_messages.h"
#include "content/common/gpu/client/gpu_memory_buffer_impl.h"
+#include "content/common/gpu/client/gpu_memory_buffer_impl_shm.h"
#include "content/common/host_shared_bitmap_manager.h"
#include "content/common/media/media_param_traits.h"
#include "content/common/view_messages.h"
@@ -1254,14 +1255,17 @@ void RenderMessageFilter::OnAllocateGpuMemoryBuffer(
uint32 width,
uint32 height,
uint32 internalformat,
+ uint32 usage,
gfx::GpuMemoryBufferHandle* handle) {
- if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) {
+ if (!GpuMemoryBufferImpl::IsFormatValid(internalformat) ||
+ !GpuMemoryBufferImpl::IsUsageValid(usage)) {
handle->type = gfx::EMPTY_BUFFER;
return;
}
#if defined(OS_MACOSX)
- if (GpuMemoryBufferImplIOSurface::IsFormatSupported(internalformat)) {
+ if (GpuMemoryBufferImplIOSurface::IsFormatSupported(internalformat) &&
+ GpuMemoryBufferImplIOSurface::IsUsageSupported(usage)) {
IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize();
if (io_surface_support) {
base::ScopedCFTypeRef<CFMutableDictionaryRef> properties;
@@ -1306,7 +1310,8 @@ void RenderMessageFilter::OnAllocateGpuMemoryBuffer(
#endif
#if defined(OS_ANDROID)
- if (GpuMemoryBufferImplSurfaceTexture::IsFormatSupported(internalformat)) {
+ if (GpuMemoryBufferImplSurfaceTexture::IsFormatSupported(internalformat) &&
+ GpuMemoryBufferImplSurfaceTexture::IsUsageSupported(usage)) {
// 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.
@@ -1334,6 +1339,11 @@ void RenderMessageFilter::OnAllocateGpuMemoryBuffer(
return;
}
+ if (!GpuMemoryBufferImplShm::IsUsageSupported(usage)) {
+ handle->type = gfx::EMPTY_BUFFER;
+ return;
+ }
+
// Fallback to fake GpuMemoryBuffer that is backed by shared memory and
// requires an upload before it can be used as a texture.
handle->type = gfx::SHARED_MEMORY_BUFFER;
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/common/child_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698