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

Unified Diff: content/browser/gpu/browser_gpu_channel_host_factory.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/browser_gpu_channel_host_factory.cc
diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc
index 0c43205d3d80b81a60230fba718914d1348b886f..4e69bf314fcfd703fd66affc60f794f671df0492 100644
--- a/content/browser/gpu/browser_gpu_channel_host_factory.cc
+++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc
@@ -469,4 +469,52 @@ void BrowserGpuChannelHostFactory::SetHandlerForControlMessages(
filter));
}
+void BrowserGpuChannelHostFactory::AllocateGpuMemoryBufferAsync(
+ const gfx::GpuMemoryBufferParams& params,
+ const AllocateGpuMemoryBufferCallback& callback) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ GetIOLoopProxy()->PostTask(
+ FROM_HERE,
+ base::Bind(
+ &BrowserGpuChannelHostFactory::AllocateGpuMemoryBufferAsyncOnIO,
+ base::Unretained(this),
+ params,
+ callback));
+}
+
+void BrowserGpuChannelHostFactory::AllocateGpuMemoryBufferAsyncOnIO(
+ const gfx::GpuMemoryBufferParams& params,
+ const AllocateGpuMemoryBufferCallback& callback) {
+ GpuProcessHost* host = GpuProcessHost::FromID(gpu_host_id_);
+ if (!host) {
+ GpuMemoryBufferAllocatedAsyncOnIO(callback, gfx::GpuMemoryBufferHandle());
+ return;
+ }
+
+ host->AllocateGpuMemoryBuffer(
+ params,
+ base::Bind(
+ &BrowserGpuChannelHostFactory::GpuMemoryBufferAllocatedAsyncOnIO,
+ callback));
+}
+
+// static
+void BrowserGpuChannelHostFactory::GpuMemoryBufferAllocatedAsyncOnIO(
+ const AllocateGpuMemoryBufferCallback& callback,
+ const gfx::GpuMemoryBufferHandle& handle) {
+ BrowserThread::PostTask(
+ BrowserThread::UI,
+ FROM_HERE,
+ base::Bind(&BrowserGpuChannelHostFactory::GpuMemoryBufferAllocatedAsync,
+ callback,
+ handle));
+}
+
+// static
+void BrowserGpuChannelHostFactory::GpuMemoryBufferAllocatedAsync(
+ const AllocateGpuMemoryBufferCallback& callback,
+ const gfx::GpuMemoryBufferHandle& handle) {
+ callback.Run(handle);
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698