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

Side by Side Diff: services/ui/ws/gpu_client.cc

Issue 2941933002: viz: Convert a sync api in ServerGpuMemoryBufferManager into async. (Closed)
Patch Set: . Created 3 years, 6 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/ws/gpu_client.h" 5 #include "services/ui/ws/gpu_client.h"
6 6
7 #include "components/viz/common/server_gpu_memory_buffer_manager.h" 7 #include "components/viz/common/server_gpu_memory_buffer_manager.h"
8 #include "services/ui/gpu/interfaces/gpu_service.mojom.h" 8 #include "services/ui/gpu/interfaces/gpu_service.mojom.h"
9 9
10 namespace {
11
12 void RunCallback(const ui::mojom::Gpu::CreateGpuMemoryBufferCallback& callback,
13 const gfx::GpuMemoryBufferHandle& handle) {
14 callback.Run(handle);
15 }
16
17 } // namespace
18
10 namespace ui { 19 namespace ui {
11 namespace ws { 20 namespace ws {
12 21
13 GpuClient::GpuClient( 22 GpuClient::GpuClient(
14 int client_id, 23 int client_id,
15 gpu::GPUInfo* gpu_info, 24 gpu::GPUInfo* gpu_info,
16 viz::ServerGpuMemoryBufferManager* gpu_memory_buffer_manager, 25 viz::ServerGpuMemoryBufferManager* gpu_memory_buffer_manager,
17 mojom::GpuService* gpu_service) 26 mojom::GpuService* gpu_service)
18 : client_id_(client_id), 27 : client_id_(client_id),
19 gpu_info_(gpu_info), 28 gpu_info_(gpu_info),
(...skipping 26 matching lines...) Expand all
46 base::Bind(&GpuClient::OnGpuChannelEstablished, 55 base::Bind(&GpuClient::OnGpuChannelEstablished,
47 weak_factory_.GetWeakPtr(), callback)); 56 weak_factory_.GetWeakPtr(), callback));
48 } 57 }
49 58
50 void GpuClient::CreateGpuMemoryBuffer( 59 void GpuClient::CreateGpuMemoryBuffer(
51 gfx::GpuMemoryBufferId id, 60 gfx::GpuMemoryBufferId id,
52 const gfx::Size& size, 61 const gfx::Size& size,
53 gfx::BufferFormat format, 62 gfx::BufferFormat format,
54 gfx::BufferUsage usage, 63 gfx::BufferUsage usage,
55 const mojom::Gpu::CreateGpuMemoryBufferCallback& callback) { 64 const mojom::Gpu::CreateGpuMemoryBufferCallback& callback) {
56 auto handle = gpu_memory_buffer_manager_->CreateGpuMemoryBufferHandle( 65 gpu_memory_buffer_manager_->AllocateGpuMemoryBuffer(
57 id, client_id_, size, format, usage, gpu::kNullSurfaceHandle); 66 id, client_id_, size, format, usage, gpu::kNullSurfaceHandle,
58 callback.Run(handle); 67 base::BindOnce(&RunCallback, callback));
59 } 68 }
60 69
61 void GpuClient::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id, 70 void GpuClient::DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
62 const gpu::SyncToken& sync_token) { 71 const gpu::SyncToken& sync_token) {
63 gpu_memory_buffer_manager_->DestroyGpuMemoryBuffer(id, client_id_, 72 gpu_memory_buffer_manager_->DestroyGpuMemoryBuffer(id, client_id_,
64 sync_token); 73 sync_token);
65 } 74 }
66 75
67 } // namespace ws 76 } // namespace ws
68 } // namespace ui 77 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698