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

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

Issue 1835173003: gpu: Remove GPU service side GMB creation from handle. Base URL: https://chromium.googlesource.com/chromium/src.git@ozone-gmb-gpu-process-refactor
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/gpu/browser_gpu_memory_buffer_manager.cc
diff --git a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
index c1e3d4e3ade3e16a853357a21a193fa5b4823ea9..2ce57f591c8091430d521f7760fcba13ac6f6a71 100644
--- a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
+++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc
@@ -42,19 +42,6 @@ void HostCreateGpuMemoryBuffer(
callback);
}
-void HostCreateGpuMemoryBufferFromHandle(
- const gfx::GpuMemoryBufferHandle& handle,
- GpuProcessHost* host,
- gfx::GpuMemoryBufferId id,
- const gfx::Size& size,
- gfx::BufferFormat format,
- gfx::BufferUsage usage,
- int client_id,
- const BrowserGpuMemoryBufferManager::CreateCallback& callback) {
- host->CreateGpuMemoryBufferFromHandle(handle, id, size, format, client_id,
- callback);
-}
-
void GpuMemoryBufferDeleted(
scoped_refptr<base::SingleThreadTaskRunner> destruction_task_runner,
const GpuMemoryBufferImpl::DestructionCallback& destruction_callback,
@@ -500,15 +487,28 @@ void BrowserGpuMemoryBufferManager::HandleCreateGpuMemoryBufferFromHandleOnIO(
request->event.Signal();
return;
}
- // Note: Unretained is safe as this is only used for synchronous allocation
- // from a non-IO thread.
- CreateGpuMemoryBufferOnIO(
- base::Bind(&HostCreateGpuMemoryBufferFromHandle, request->handle),
- new_id, request->size, request->format, request->usage,
- request->client_id, false,
+
+ BufferMap& buffers = clients_[request->client_id];
+
+ auto insert_result = buffers.insert(std::make_pair(
+ new_id, BufferInfo(request->size, request->handle.type, request->format,
+ request->usage, 0)));
+ DCHECK(insert_result.second);
+
+ gfx::GpuMemoryBufferHandle handle = request->handle;
+ handle.id = new_id;
+
+ // Note: Unretained is safe as IO thread is stopped before manager is
+ // destroyed.
+ request->result = GpuMemoryBufferImpl::CreateFromHandle(
+ handle, request->size, request->format, request->usage,
base::Bind(
- &BrowserGpuMemoryBufferManager::HandleGpuMemoryBufferCreatedOnIO,
- base::Unretained(this), base::Unretained(request)));
+ &GpuMemoryBufferDeleted,
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO),
+ base::Bind(
+ &BrowserGpuMemoryBufferManager::DestroyGpuMemoryBufferOnIO,
+ base::Unretained(this), handle.id, request->client_id)));
+ request->event.Signal();
return;
}
« no previous file with comments | « no previous file | content/browser/gpu/gpu_process_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698