blob: ac5f07292b23d2fe1859076bc803b9280cadf2ec (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef SERVICES_UI_WS_GPU_CLIENT_H_
#define SERVICES_UI_WS_GPU_CLIENT_H_
#include "base/memory/weak_ptr.h"
#include "gpu/config/gpu_info.h"
#include "services/ui/public/interfaces/gpu.mojom.h"
namespace ui {
namespace mojom {
class GpuService;
} // namespace mojom
class ServerGpuMemoryBufferManager;
namespace ws {
namespace test {
class GpuHostTest;
} // namespace test
// The implementation that relays requests from clients to the real
// service implementation in the GPU process over mojom.GpuService.
class GpuClient : public mojom::Gpu {
public:
GpuClient(int client_id,
gpu::GPUInfo* gpu_info,
ServerGpuMemoryBufferManager* gpu_memory_buffer_manager,
mojom::GpuService* gpu_service);
~GpuClient() override;
private:
friend class test::GpuHostTest;
// EstablishGpuChannelCallback:
void OnGpuChannelEstablished(const EstablishGpuChannelCallback& callback,
mojo::ScopedMessagePipeHandle channel_handle);
// mojom::Gpu overrides:
void EstablishGpuChannel(
const EstablishGpuChannelCallback& callback) override;
void CreateGpuMemoryBuffer(
gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
const mojom::Gpu::CreateGpuMemoryBufferCallback& callback) override;
void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
const gpu::SyncToken& sync_token) override;
const int client_id_;
// The objects these pointers refer to are owned by the GpuHost object.
const gpu::GPUInfo* gpu_info_;
ServerGpuMemoryBufferManager* gpu_memory_buffer_manager_;
mojom::GpuService* gpu_service_;
base::WeakPtrFactory<GpuClient> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(GpuClient);
};
} // namespace ws
} // namespace ui
#endif // SERVICES_UI_WS_GPU_CLIENT_H_
|