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

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

Issue 100053005: Allow AllocateGpuMemoryBuffer to be called from multiple threads. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 55e10b5cf34afc9fd5ceddb9fb8637cf7d899be2..29c39c43441495fb5fa9f509271fb57251653a80 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -376,6 +376,15 @@ void RenderMessageFilter::OnChannelConnected(int32 peer_id) {
bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message,
bool* message_was_ok) {
+#if defined(OS_MACOSX)
+ // Remove surface references that are now in use by the renderer.
+ while (!io_surfaces_.empty()) {
+ IOSurfaceSupport* io_surface_support = IOSurfaceSupport::Initialize();
+ if (!io_surface_support->IOSurfaceIsInUse(io_surfaces_.front()))
+ break;
+ io_surfaces_.pop();
+ }
+#endif
bool handled = true;
IPC_BEGIN_MESSAGE_MAP_EX(RenderMessageFilter, message, *message_was_ok)
#if defined(OS_WIN)
@@ -1220,10 +1229,9 @@ void RenderMessageFilter::OnAllocateGpuMemoryBuffer(
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;
+ DCHECK(!io_surface_support->IOSurfaceIsInUse(io_surface));
+ // Keep a reference to the surface until it's in use by the renderer.
+ io_surfaces_.push(io_surface);
return;
}
}
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/common/gpu/client/gpu_memory_buffer_impl_io_surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698