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

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

Issue 2701233002: gpu: Use mojom.GpuService API for memory allocation. (Closed)
Patch Set: . Created 3 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 | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu_host_messages.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 643b6418edf464f6be312817f337762799bd05e7..a0041b29b6adbb8c1d3dee50adaa0775a7d3dffc 100644
--- a/content/browser/gpu/gpu_process_host.cc
+++ b/content/browser/gpu/gpu_process_host.cc
@@ -703,8 +703,6 @@ void GpuProcessHost::AddFilter(IPC::MessageFilter* filter) {
bool GpuProcessHost::OnMessageReceived(const IPC::Message& message) {
DCHECK(CalledOnValidThread());
IPC_BEGIN_MESSAGE_MAP(GpuProcessHost, message)
- IPC_MESSAGE_HANDLER(GpuHostMsg_GpuMemoryBufferCreated,
- OnGpuMemoryBufferCreated)
IPC_MESSAGE_HANDLER(GpuHostMsg_FieldTrialActivated, OnFieldTrialActivated);
IPC_MESSAGE_UNHANDLED(RouteOnUIThread(message))
IPC_END_MESSAGE_MAP()
@@ -765,29 +763,18 @@ void GpuProcessHost::CreateGpuMemoryBuffer(
TRACE_EVENT0("gpu", "GpuProcessHost::CreateGpuMemoryBuffer");
DCHECK(CalledOnValidThread());
-
- GpuMsg_CreateGpuMemoryBuffer_Params params;
- params.id = id;
- params.size = size;
- params.format = format;
- params.usage = usage;
- params.client_id = client_id;
- params.surface_handle = surface_handle;
- if (Send(new GpuMsg_CreateGpuMemoryBuffer(params))) {
- create_gpu_memory_buffer_requests_.push(callback);
- } else {
- callback.Run(gfx::GpuMemoryBufferHandle());
- }
+ create_gpu_memory_buffer_requests_.push(callback);
+ gpu_service_ptr_->CreateGpuMemoryBuffer(
+ id, size, format, usage, client_id, surface_handle,
+ base::Bind(&GpuProcessHost::OnGpuMemoryBufferCreated,
+ weak_ptr_factory_.GetWeakPtr()));
}
void GpuProcessHost::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
int client_id,
const gpu::SyncToken& sync_token) {
TRACE_EVENT0("gpu", "GpuProcessHost::DestroyGpuMemoryBuffer");
-
- DCHECK(CalledOnValidThread());
-
- Send(new GpuMsg_DestroyGpuMemoryBuffer(id, client_id, sync_token));
+ gpu_service_ptr_->DestroyGpuMemoryBuffer(id, client_id, sync_token);
}
#if defined(OS_ANDROID)
@@ -830,11 +817,8 @@ 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();
+ DCHECK(!create_gpu_memory_buffer_requests_.empty());
+ auto callback = create_gpu_memory_buffer_requests_.front();
create_gpu_memory_buffer_requests_.pop();
callback.Run(handle);
}
@@ -1120,8 +1104,7 @@ void GpuProcessHost::SendOutstandingReplies() {
}
while (!create_gpu_memory_buffer_requests_.empty()) {
- CreateGpuMemoryBufferCallback callback =
- create_gpu_memory_buffer_requests_.front();
+ auto callback = create_gpu_memory_buffer_requests_.front();
create_gpu_memory_buffer_requests_.pop();
callback.Run(gfx::GpuMemoryBufferHandle());
}
« no previous file with comments | « content/browser/gpu/gpu_process_host.h ('k') | content/common/gpu_host_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698