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

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

Issue 302443008: content: Always allocate GpuMemoryBuffers on UI thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: one more android build fix 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
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 4364f1758871334dfda3626de1999f8a33f48ddd..780d930fb1b522303c03b22719aa15fd3c55cbdc 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -10,7 +10,6 @@
#include "base/bind_helpers.h"
#include "base/command_line.h"
#include "base/debug/alias.h"
-#include "base/numerics/safe_math.h"
#include "base/strings/sys_string_conversions.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread.h"
@@ -35,8 +34,6 @@
#include "content/common/cookie_data.h"
#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"
@@ -73,9 +70,7 @@
#include "ui/gfx/color_profile.h"
#if defined(OS_MACOSX)
-#include "content/common/gpu/client/gpu_memory_buffer_impl_io_surface.h"
#include "content/common/mac/font_descriptor.h"
-#include "ui/gl/io_surface_support_mac.h"
#else
#include "gpu/GLES2/gl2extchromium.h"
#include "third_party/khronos/GLES2/gl2.h"
@@ -89,8 +84,6 @@
#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
@@ -222,23 +215,6 @@ class OpenChannelToPpapiBrokerCallback
int routing_id_;
};
-#if defined(OS_MACOSX)
-void AddBooleanValue(CFMutableDictionaryRef dictionary,
- const CFStringRef key,
- bool value) {
- CFDictionaryAddValue(
- dictionary, key, value ? kCFBooleanTrue : kCFBooleanFalse);
-}
-
-void AddIntegerValue(CFMutableDictionaryRef dictionary,
- const CFStringRef key,
- int32 value) {
- base::ScopedCFTypeRef<CFNumberRef> number(
- CFNumberCreate(NULL, kCFNumberSInt32Type, &value));
- CFDictionaryAddValue(dictionary, key, number.get());
-}
-#endif
-
} // namespace
class RenderMessageFilter::OpenChannelToNpapiPluginCallback
@@ -376,9 +352,6 @@ 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) {
@@ -438,9 +411,6 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
OnAllocateSharedMemory)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedBitmap,
OnAllocateSharedBitmap)
- IPC_MESSAGE_HANDLER_DELAY_REPLY(
- ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer,
- OnAllocateGpuMemoryBuffer)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_AllocatedSharedBitmap,
OnAllocatedSharedBitmap)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedSharedBitmap,
@@ -1229,111 +1199,4 @@ void RenderMessageFilter::OnWebAudioMediaCodec(
}
#endif
-void RenderMessageFilter::OnAllocateGpuMemoryBuffer(uint32 width,
- uint32 height,
- uint32 internalformat,
- uint32 usage,
- IPC::Message* reply) {
- if (!GpuMemoryBufferImpl::IsFormatValid(internalformat) ||
- !GpuMemoryBufferImpl::IsUsageValid(usage)) {
- GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle());
- return;
- }
- base::CheckedNumeric<int> size = width;
- size *= height;
- if (!size.IsValid()) {
- GpuMemoryBufferAllocated(reply, gfx::GpuMemoryBufferHandle());
- return;
- }
-
-#if defined(OS_MACOSX)
- // TODO(reveman): This should be moved to
- // GpuMemoryBufferImpl::AllocateForChildProcess and
- // GpuMemoryBufferImplIOSurface. crbug.com/325045, crbug.com/323304
- if (GpuMemoryBufferImplIOSurface::IsConfigurationSupported(internalformat,
- usage)) {
- IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize();
- if (io_surface_support) {
- base::ScopedCFTypeRef<CFMutableDictionaryRef> properties;
- properties.reset(
- CFDictionaryCreateMutable(kCFAllocatorDefault,
- 0,
- &kCFTypeDictionaryKeyCallBacks,
- &kCFTypeDictionaryValueCallBacks));
- AddIntegerValue(properties,
- io_surface_support->GetKIOSurfaceWidth(),
- width);
- AddIntegerValue(properties,
- io_surface_support->GetKIOSurfaceHeight(),
- height);
- AddIntegerValue(properties,
- io_surface_support->GetKIOSurfaceBytesPerElement(),
- GpuMemoryBufferImpl::BytesPerPixel(internalformat));
- AddIntegerValue(properties,
- io_surface_support->GetKIOSurfacePixelFormat(),
- GpuMemoryBufferImplIOSurface::PixelFormat(
- internalformat));
- // TODO(reveman): Remove this when using a mach_port_t to transfer
- // IOSurface to renderer process. crbug.com/323304
- AddBooleanValue(properties,
- io_surface_support->GetKIOSurfaceIsGlobal(),
- true);
-
- base::ScopedCFTypeRef<CFTypeRef> io_surface(
- io_surface_support->IOSurfaceCreate(properties));
- if (io_surface) {
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::IO_SURFACE_BUFFER;
- handle.io_surface_id = io_surface_support->IOSurfaceGetID(io_surface);
-
- // TODO(reveman): This makes the assumption that the renderer will
- // grab a reference to the surface before sending another message.
- // crbug.com/325045
- last_io_surface_ = io_surface;
- GpuMemoryBufferAllocated(reply, handle);
- return;
- }
- }
- }
-#endif
-
-#if defined(OS_ANDROID)
- // TODO(reveman): This should be moved to
- // GpuMemoryBufferImpl::AllocateForChildProcess and
- // GpuMemoryBufferImplSurfaceTexture when adding support for out-of-process
- // GPU service. crbug.com/368716
- if (GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported(
- internalformat, 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.
- int surface_texture_id =
- CompositorImpl::CreateSurfaceTexture(render_process_id_);
- if (surface_texture_id != -1) {
- gfx::GpuMemoryBufferHandle handle;
- handle.type = gfx::SURFACE_TEXTURE_BUFFER;
- handle.surface_texture_id =
- gfx::SurfaceTextureId(surface_texture_id, render_process_id_);
- GpuMemoryBufferAllocated(reply, handle);
- return;
- }
- }
-#endif
-
- GpuMemoryBufferImpl::AllocateForChildProcess(
- gfx::Size(width, height),
- internalformat,
- usage,
- PeerHandle(),
- base::Bind(&RenderMessageFilter::GpuMemoryBufferAllocated, this, reply));
-}
-
-void RenderMessageFilter::GpuMemoryBufferAllocated(
- IPC::Message* reply,
- const gfx::GpuMemoryBufferHandle& handle) {
- ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer::WriteReplyParams(reply,
- handle);
- Send(reply);
-}
-
} // namespace content
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/browser/renderer_host/render_process_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698