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 97a9ef868354a1a9cc55038114d1a7542db908ce..9715a2508acb75fb53c3963b29615b93db78dafb 100644 |
--- a/content/browser/gpu/gpu_process_host.cc |
+++ b/content/browser/gpu/gpu_process_host.cc |
@@ -562,6 +562,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_GpuMemoryBufferAllocated, |
+ OnGpuMemoryBufferAllocated) |
IPC_MESSAGE_HANDLER(GpuHostMsg_DidCreateOffscreenContext, |
OnDidCreateOffscreenContext) |
IPC_MESSAGE_HANDLER(GpuHostMsg_DidLoseContext, OnDidLoseContext) |
@@ -667,6 +669,20 @@ void GpuProcessHost::DeleteImage(int client_id, |
Send(new GpuMsg_DeleteImage(client_id, image_id, sync_point)); |
} |
+void GpuProcessHost::AllocateGpuMemoryBuffer( |
+ const gfx::GpuMemoryBufferParams& params, |
+ const AllocateGpuMemoryBufferCallback& callback) { |
+ TRACE_EVENT0("gpu", "GpuProcessHost::CreateImage"); |
+ |
+ DCHECK(CalledOnValidThread()); |
+ |
+ if (Send(new GpuMsg_AllocateGpuMemoryBuffer(params))) { |
+ allocate_gpu_memory_buffer_requests_.push(callback); |
+ } else { |
+ callback.Run(gfx::GpuMemoryBufferHandle()); |
+ } |
+} |
+ |
void GpuProcessHost::OnInitialized(bool result, const gpu::GPUInfo& gpu_info) { |
UMA_HISTOGRAM_BOOLEAN("GPU.GPUProcessInitialized", result); |
initialized_ = result; |
@@ -740,6 +756,19 @@ void GpuProcessHost::OnImageCreated(const gfx::Size size) { |
callback.Run(size); |
} |
+void GpuProcessHost::OnGpuMemoryBufferAllocated( |
+ const gfx::GpuMemoryBufferHandle& handle) { |
+ TRACE_EVENT0("gpu", "GpuProcessHost::OnImageCreated"); |
+ |
+ if (allocate_gpu_memory_buffer_requests_.empty()) |
+ return; |
+ |
+ AllocateGpuMemoryBufferCallback callback = |
+ allocate_gpu_memory_buffer_requests_.front(); |
+ allocate_gpu_memory_buffer_requests_.pop(); |
+ callback.Run(handle); |
+} |
+ |
void GpuProcessHost::OnDidCreateOffscreenContext(const GURL& url) { |
urls_with_live_offscreen_contexts_.insert(url); |
} |