Index: content/renderer/render_thread_impl.cc |
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc |
index 3842bca15684605283d42e4376996aeb1eb0c7fa..3effe911c5a87416446522ddbfb99c05f7824cc4 100644 |
--- a/content/renderer/render_thread_impl.cc |
+++ b/content/renderer/render_thread_impl.cc |
@@ -318,6 +318,13 @@ blink::WebGraphicsContext3D::Attributes GetOffscreenAttribs() { |
return attributes; |
} |
+void DeletedGpuMemoryBuffer(scoped_refptr<ThreadSafeSender> sender, |
+ gfx::GpuMemoryBufferType type, |
+ const gfx::GpuMemoryBufferId& id) { |
+ TRACE_EVENT0("renderer", "RenderThreadImpl::DeletedGpuMemoryBuffer"); |
+ sender->Send(new ChildProcessHostMsg_DeletedGpuMemoryBuffer(type, id)); |
+} |
+ |
} // namespace |
// For measuring memory usage after each task. Behind a command line flag. |
@@ -1277,6 +1284,8 @@ scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( |
size_t height, |
unsigned internalformat, |
unsigned usage) { |
+ TRACE_EVENT0("renderer", "RenderThreadImpl::AllocateGpuMemoryBuffer"); |
+ |
DCHECK(allocate_gpu_memory_buffer_thread_checker_.CalledOnValidThread()); |
if (!GpuMemoryBufferImpl::IsFormatValid(internalformat)) |
@@ -1297,19 +1306,13 @@ scoped_ptr<gfx::GpuMemoryBuffer> RenderThreadImpl::AllocateGpuMemoryBuffer( |
return scoped_ptr<gfx::GpuMemoryBuffer>(); |
return GpuMemoryBufferImpl::CreateFromHandle( |
- handle, gfx::Size(width, height), internalformat) |
- .PassAs<gfx::GpuMemoryBuffer>(); |
-} |
- |
-void RenderThreadImpl::DeleteGpuMemoryBuffer( |
- scoped_ptr<gfx::GpuMemoryBuffer> buffer) { |
- gfx::GpuMemoryBufferHandle handle(buffer->GetHandle()); |
- |
- IPC::Message* message = new ChildProcessHostMsg_DeletedGpuMemoryBuffer( |
- handle.type, handle.global_id); |
- |
- // Allow calling this from the compositor thread. |
- thread_safe_sender()->Send(message); |
+ handle, |
+ gfx::Size(width, height), |
+ internalformat, |
+ base::Bind(&DeletedGpuMemoryBuffer, |
+ make_scoped_refptr(thread_safe_sender()), |
piman
2014/09/24 03:19:10
nit: you don't need make_scoped_refptr, Bind figur
reveman
2014/09/24 06:03:38
hm, I think we do, unless I'm doing something comp
piman
2014/09/24 06:40:28
Ah, sorry you're right. What I said is only true f
reveman
2014/09/24 07:10:54
Are you saying I could safely use base::Unretained
|
+ handle.type, |
+ handle.global_id)).PassAs<gfx::GpuMemoryBuffer>(); |
piman
2014/09/24 03:19:10
Should DeletedGpuMemoryBuffer be called if CreateF
reveman
2014/09/24 06:03:38
Good catch. Done.
|
} |
void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { |