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 b1fb21abe592b8a456914d6adf21b172808a9a2b..a3b0cbea619550acf9a72c2c52d01c87907dde3b 100644 |
--- a/content/browser/renderer_host/render_message_filter.cc |
+++ b/content/browser/renderer_host/render_message_filter.cc |
@@ -20,6 +20,7 @@ |
#include "content/browser/dom_storage/dom_storage_context_wrapper.h" |
#include "content/browser/dom_storage/session_storage_namespace_impl.h" |
#include "content/browser/download/download_stats.h" |
+#include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
#include "content/browser/gpu/gpu_data_manager_impl.h" |
#include "content/browser/loader/resource_dispatcher_host_impl.h" |
#include "content/browser/media/media_internals.h" |
@@ -340,6 +341,7 @@ RenderMessageFilter::~RenderMessageFilter() { |
DCHECK_CURRENTLY_ON(BrowserThread::IO); |
DCHECK(plugin_host_clients_.empty()); |
HostSharedBitmapManager::current()->ProcessRemoved(PeerHandle()); |
+ BrowserGpuMemoryBufferManager::current()->ProcessRemoved(PeerHandle()); |
} |
void RenderMessageFilter::OnChannelClosing() { |
@@ -1239,16 +1241,12 @@ void RenderMessageFilter::OnAddNavigationTransitionData( |
selector, markup); |
} |
-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; |
- } |
+void RenderMessageFilter::OnAllocateGpuMemoryBuffer( |
+ uint32 width, |
+ uint32 height, |
+ gfx::GpuMemoryBuffer::Format format, |
+ gfx::GpuMemoryBuffer::Usage usage, |
+ IPC::Message* reply) { |
base::CheckedNumeric<int> size = width; |
size *= height; |
if (!size.IsValid()) { |
@@ -1261,8 +1259,8 @@ void RenderMessageFilter::OnAllocateGpuMemoryBuffer(uint32 width, |
// GpuMemoryBufferImpl::AllocateForChildProcess and |
// GpuMemoryBufferImplSurfaceTexture when adding support for out-of-process |
// GPU service. crbug.com/368716 |
- if (GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported( |
- internalformat, usage)) { |
+ if (GpuMemoryBufferImplSurfaceTexture::IsConfigurationSupported(format, |
+ 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. |
@@ -1279,13 +1277,15 @@ void RenderMessageFilter::OnAllocateGpuMemoryBuffer(uint32 width, |
} |
#endif |
- GpuMemoryBufferImpl::AllocateForChildProcess( |
- gfx::Size(width, height), |
- internalformat, |
- usage, |
- PeerHandle(), |
- render_process_id_, |
- base::Bind(&RenderMessageFilter::GpuMemoryBufferAllocated, this, reply)); |
+ BrowserGpuMemoryBufferManager::current() |
+ ->AllocateGpuMemoryBufferForChildProcess( |
+ gfx::Size(width, height), |
+ format, |
+ usage, |
+ PeerHandle(), |
+ render_process_id_, |
+ base::Bind( |
+ &RenderMessageFilter::GpuMemoryBufferAllocated, this, reply)); |
} |
void RenderMessageFilter::GpuMemoryBufferAllocated( |
@@ -1300,7 +1300,8 @@ void RenderMessageFilter::GpuMemoryBufferAllocated( |
void RenderMessageFilter::OnDeletedGpuMemoryBuffer( |
gfx::GpuMemoryBufferType type, |
const gfx::GpuMemoryBufferId& id) { |
- GpuMemoryBufferImpl::DeletedByChildProcess(type, id, PeerHandle()); |
+ BrowserGpuMemoryBufferManager::current()->ChildProcessDeletedGpuMemoryBuffer( |
+ type, id, PeerHandle()); |
} |
} // namespace content |