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

Unified Diff: content/browser/gpu/gpu_process_host.cc

Issue 302603004: Plumb GpuMemoryBuffer allocation to GPU process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 months 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/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);
}

Powered by Google App Engine
This is Rietveld 408576698