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

Side by Side Diff: services/ui/common/server_gpu_memory_buffer_manager.h

Issue 2939953004: viz: Move some code into //components/viz/common. (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
« no previous file with comments | « services/ui/common/BUILD.gn ('k') | services/ui/common/server_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_UI_COMMON_SERVER_GPU_MEMORY_BUFFER_MANAGER_H_
6 #define SERVICES_UI_COMMON_SERVER_GPU_MEMORY_BUFFER_MANAGER_H_
7
8 #include <memory>
9
10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h"
12 #include "base/threading/thread_checker.h"
13 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
14 #include "gpu/ipc/host/gpu_memory_buffer_support.h"
15 #include "services/ui/gpu/interfaces/gpu_service.mojom.h"
16
17 namespace ui {
18
19 // This GpuMemoryBufferManager is for establishing a GpuChannelHost used by
20 // mus locally.
21 class ServerGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager,
22 public base::ThreadChecker {
23 public:
24 ServerGpuMemoryBufferManager(mojom::GpuService* gpu_service, int client_id);
25 ~ServerGpuMemoryBufferManager() override;
26
27 void DestroyGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
28 int client_id,
29 const gpu::SyncToken& sync_token);
30
31 void DestroyAllGpuMemoryBufferForClient(int client_id);
32
33 gfx::GpuMemoryBufferHandle CreateGpuMemoryBufferHandle(
34 gfx::GpuMemoryBufferId id,
35 int client_id,
36 const gfx::Size& size,
37 gfx::BufferFormat format,
38 gfx::BufferUsage usage,
39 gpu::SurfaceHandle surface_handle);
40
41 // Overridden from gpu::GpuMemoryBufferManager:
42 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer(
43 const gfx::Size& size,
44 gfx::BufferFormat format,
45 gfx::BufferUsage usage,
46 gpu::SurfaceHandle surface_handle) override;
47 void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer,
48 const gpu::SyncToken& sync_token) override;
49
50 private:
51 mojom::GpuService* gpu_service_;
52 const int client_id_;
53 int next_gpu_memory_id_ = 1;
54
55 using NativeBuffers =
56 std::unordered_set<gfx::GpuMemoryBufferId,
57 BASE_HASH_NAMESPACE::hash<gfx::GpuMemoryBufferId>>;
58 std::unordered_map<int, NativeBuffers> native_buffers_;
59
60 const gpu::GpuMemoryBufferConfigurationSet native_configurations_;
61 base::WeakPtrFactory<ServerGpuMemoryBufferManager> weak_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(ServerGpuMemoryBufferManager);
64 };
65
66 } // namespace ui
67
68 #endif // SERVICES_UI_COMMON_SERVER_GPU_MEMORY_BUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « services/ui/common/BUILD.gn ('k') | services/ui/common/server_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698