Index: content/browser/gpu/gpu_process_host.cc |
diff --git a/content/browser/gpu/gpu_process_host.cc b/content/browser/gpu/gpu_process_host.cc |
index 423c18727fd412d6106f5580a32461ca5e11ab4d..721fa41f529771ebe50e94a76749209923ebd49d 100644 |
--- a/content/browser/gpu/gpu_process_host.cc |
+++ b/content/browser/gpu/gpu_process_host.cc |
@@ -566,6 +566,8 @@ bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) { |
IPC_MESSAGE_HANDLER(GpuHostMsg_CommandBufferCreated, OnCommandBufferCreated) |
IPC_MESSAGE_HANDLER(GpuHostMsg_DestroyCommandBuffer, OnDestroyCommandBuffer) |
IPC_MESSAGE_HANDLER(GpuHostMsg_ImageCreated, OnImageCreated) |
+ IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated, |
+ OnGpuMemoryBufferCreated) |
IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext, |
OnDidCreateOffscreenContext) |
IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) |
@@ -671,6 +673,34 @@ void GpuProcessHost::DeleteImage(int client_id, |
Send(new GpuMsg_DeleteImage(client_id, image_id, sync_point)); |
} |
+void GpuProcessHost::CreateGpuMemoryBuffer( |
+ const gfx::GpuMemoryBufferHandle& handle, |
+ const gfx::Size& size, |
+ unsigned internalformat, |
+ unsigned usage, |
+ const CreateGpuMemoryBufferCallback& callback) { |
+ TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer"); |
+ |
+ DCHECK(CalledOnValidThread()); |
+ |
+ if (Send(new GpuMsg_CreateGpuMemoryBuffer( |
+ handle, size, internalformat, usage))) { |
+ create_gpu_memory_buffer_requests_.push(callback); |
+ } else { |
+ callback.Run(gfx::GpuMemoryBufferHandle()); |
+ } |
+} |
+ |
+void GpuProcessHost::DestroyGpuMemoryBuffer( |
+ const gfx::GpuMemoryBufferHandle& handle, |
+ int sync_point) { |
+ TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer"); |
+ |
+ DCHECK(CalledOnValidThread()); |
+ |
+ Send(new GpuMsg_DestroyGpuMemoryBuffer(handle, sync_point)); |
+} |
+ |
void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { |
UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); |
initialized_ = result; |
@@ -744,6 +774,19 @@ void GpuProcessHost::OnImageCreated(const gfx::Size size) { |
callback.Run(size); |
} |
+void GpuProcessHost::OnGpuMemoryBufferCreated( |
+ const gfx::GpuMemoryBufferHandle& handle) { |
+ TRACE_EVENT0("gpu", "GpuProcessHost::OnGpuMemoryBufferCreated"); |
+ |
+ if (create_gpu_memory_buffer_requests_.empty()) |
+ return; |
+ |
+ CreateGpuMemoryBufferCallback callback = |
+ create_gpu_memory_buffer_requests_.front(); |
+ create_gpu_memory_buffer_requests_.pop(); |
+ callback.Run(handle); |
+} |
+ |
void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) { |
urls_with_live_offscreen_contexts_.insert(url); |
} |