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

Side by Side Diff: services/ui/gpu/gpu_service_internal.cc

Issue 2360203003: services/ui: Add mojom API for creating/destroying gpu memory buffer. (Closed)
Patch Set: . Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "services/ui/gpu/gpu_service_internal.h" 5 #include "services/ui/gpu/gpu_service_internal.h"
6 6
7 #include "base/memory/shared_memory.h" 7 #include "base/memory/shared_memory.h"
8 #include "base/threading/thread_task_runner_handle.h" 8 #include "base/threading/thread_task_runner_handle.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "gpu/command_buffer/service/gpu_switches.h" 10 #include "gpu/command_buffer/service/gpu_switches.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 // For example, in the renderer the RenderThread instances will be able to 54 // For example, in the renderer the RenderThread instances will be able to
55 // notice shutdown before the render process begins waiting for them to exit. 55 // notice shutdown before the render process begins waiting for them to exit.
56 shutdown_event_.Signal(); 56 shutdown_event_.Signal();
57 } 57 }
58 58
59 void GpuServiceInternal::Add(mojom::GpuServiceInternalRequest request) { 59 void GpuServiceInternal::Add(mojom::GpuServiceInternalRequest request) {
60 binding_.Close(); 60 binding_.Close();
61 binding_.Bind(std::move(request)); 61 binding_.Bind(std::move(request));
62 } 62 }
63 63
64 gfx::GpuMemoryBufferHandle GpuServiceInternal::CreateGpuMemoryBuffer( 64 void GpuServiceInternal::CreateGpuMemoryBuffer(
65 gfx::GpuMemoryBufferId id, 65 gfx::GpuMemoryBufferId id,
66 const gfx::Size& size, 66 const gfx::Size& size,
67 gfx::BufferFormat format, 67 gfx::BufferFormat format,
68 gfx::BufferUsage usage, 68 gfx::BufferUsage usage,
69 int client_id, 69 int client_id,
70 gpu::SurfaceHandle surface_handle) { 70 gpu::SurfaceHandle surface_handle,
71 const CreateGpuMemoryBufferCallback& callback) {
71 DCHECK(CalledOnValidThread()); 72 DCHECK(CalledOnValidThread());
72 return gpu_memory_buffer_factory_->CreateGpuMemoryBuffer( 73 callback.Run(gpu_memory_buffer_factory_->CreateGpuMemoryBuffer(
73 id, size, format, usage, client_id, surface_handle); 74 id, size, format, usage, client_id, surface_handle));
74 } 75 }
75 76
76 void GpuServiceInternal::DestroyGpuMemoryBuffer( 77 void GpuServiceInternal::DestroyGpuMemoryBuffer(
77 gfx::GpuMemoryBufferId id, 78 gfx::GpuMemoryBufferId id,
78 int client_id, 79 int client_id,
79 const gpu::SyncToken& sync_token) { 80 const gpu::SyncToken& sync_token) {
80 DCHECK(CalledOnValidThread()); 81 DCHECK(CalledOnValidThread());
81 if (gpu_channel_manager_) 82 if (gpu_channel_manager_)
82 gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token); 83 gpu_channel_manager_->DestroyGpuMemoryBuffer(id, client_id, sync_token);
83 } 84 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 mojo::ScopedMessagePipeHandle channel_handle; 165 mojo::ScopedMessagePipeHandle channel_handle;
165 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel( 166 IPC::ChannelHandle handle = gpu_channel_manager_->EstablishChannel(
166 client_id, client_tracing_id, preempts, allow_view_command_buffers, 167 client_id, client_tracing_id, preempts, allow_view_command_buffers,
167 allow_real_time_streams); 168 allow_real_time_streams);
168 channel_handle.reset(handle.mojo_handle); 169 channel_handle.reset(handle.mojo_handle);
169 media_service_->AddChannel(client_id); 170 media_service_->AddChannel(client_id);
170 callback.Run(std::move(channel_handle)); 171 callback.Run(std::move(channel_handle));
171 } 172 }
172 173
173 } // namespace ui 174 } // namespace ui
OLDNEW
« no previous file with comments | « services/ui/gpu/gpu_service_internal.h ('k') | services/ui/gpu/interfaces/gpu_service_internal.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698