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

Side by Side Diff: services/ui/public/cpp/mojo_gpu_memory_buffer_manager.h

Issue 2511143004: mus: Split the gpu client-lib into a separate component. (Closed)
Patch Set: . Created 4 years, 1 month 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
(Empty)
1 // Copyright 2015 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_PUBLIC_CPP_MOJO_GPU_MEMORY_BUFFER_MANAGER_H_
6 #define SERVICES_UI_PUBLIC_CPP_MOJO_GPU_MEMORY_BUFFER_MANAGER_H_
7
8 #include <memory>
9 #include <vector>
10
11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread.h"
15 #include "gpu/command_buffer/client/gpu_memory_buffer_manager.h"
16 #include "services/ui/public/interfaces/gpu_service.mojom.h"
17
18 namespace base {
19 class WaitableEvent;
20 }
21
22 namespace service_manager {
23 class Connector;
24 }
25
26 namespace ui {
27
28 namespace mojom {
29 class GpuService;
30 }
31
32 class MojoGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager {
33 public:
34 explicit MojoGpuMemoryBufferManager(service_manager::Connector* connector);
35 ~MojoGpuMemoryBufferManager() override;
36
37 private:
38 void InitThread();
39 void TearDownThread();
40 void AllocateGpuMemoryBufferOnThread(const gfx::Size& size,
41 gfx::BufferFormat format,
42 gfx::BufferUsage usage,
43 gfx::GpuMemoryBufferHandle* handle,
44 base::WaitableEvent* wait);
45 void DeletedGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
46 const gpu::SyncToken& sync_token);
47
48 // Overridden from gpu::GpuMemoryBufferManager:
49 std::unique_ptr<gfx::GpuMemoryBuffer> AllocateGpuMemoryBuffer(
50 const gfx::Size& size,
51 gfx::BufferFormat format,
52 gfx::BufferUsage usage,
53 gpu::SurfaceHandle surface_handle) override;
54 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
55 const gfx::GpuMemoryBufferHandle& handle,
56 const gfx::Size& size,
57 gfx::BufferFormat format) override;
58 void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer,
59 const gpu::SyncToken& sync_token) override;
60 int counter_ = 0;
61 // TODO(sad): Explore the option of doing this from an existing thread.
62 base::Thread thread_;
63 mojom::GpuServicePtr gpu_service_;
64 std::unique_ptr<service_manager::Connector> connector_;
65 base::WeakPtrFactory<MojoGpuMemoryBufferManager> weak_ptr_factory_;
66
67 DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferManager);
68 };
69
70 } // namespace ui
71
72 #endif // SERVICES_UI_PUBLIC_CPP_MOJO_GPU_MEMORY_BUFFER_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698