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

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

Issue 2562623005: mus/gpu: Rename the client/server side memory buffer managers. (Closed)
Patch Set: tot merge Created 4 years 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_GPU_MOJO_GPU_MEMORY_BUFFER_MANAGER_H_
6 #define SERVICES_UI_PUBLIC_CPP_GPU_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 ui {
23
24 namespace mojom {
25 class GpuService;
26 }
27
28 class MojoGpuMemoryBufferManager : public gpu::GpuMemoryBufferManager {
29 public:
30 explicit MojoGpuMemoryBufferManager(mojom::GpuServicePtr gpu_service);
31 ~MojoGpuMemoryBufferManager() override;
32
33 private:
34 void InitThread(mojo::InterfacePtrInfo<mojom::GpuService> gpu_service_info);
35 void TearDownThread();
36 void AllocateGpuMemoryBufferOnThread(const gfx::Size& size,
37 gfx::BufferFormat format,
38 gfx::BufferUsage usage,
39 gfx::GpuMemoryBufferHandle* handle,
40 base::WaitableEvent* wait);
41 void DeletedGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
42 const gpu::SyncToken& sync_token);
43
44 // Overridden from gpu::GpuMemoryBufferManager:
45 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBuffer(
46 const gfx::Size& size,
47 gfx::BufferFormat format,
48 gfx::BufferUsage usage,
49 gpu::SurfaceHandle surface_handle) override;
50 std::unique_ptr<gfx::GpuMemoryBuffer> CreateGpuMemoryBufferFromHandle(
51 const gfx::GpuMemoryBufferHandle& handle,
52 const gfx::Size& size,
53 gfx::BufferFormat format) override;
54 void SetDestructionSyncToken(gfx::GpuMemoryBuffer* buffer,
55 const gpu::SyncToken& sync_token) override;
56 int counter_ = 0;
57 // TODO(sad): Explore the option of doing this from an existing thread.
58 base::Thread thread_;
59 mojom::GpuServicePtr gpu_service_;
60 base::WeakPtr<MojoGpuMemoryBufferManager> weak_ptr_;
61 base::WeakPtrFactory<MojoGpuMemoryBufferManager> weak_ptr_factory_;
62
63 DISALLOW_COPY_AND_ASSIGN(MojoGpuMemoryBufferManager);
64 };
65
66 } // namespace ui
67
68 #endif // SERVICES_UI_PUBLIC_CPP_GPU_MOJO_GPU_MEMORY_BUFFER_MANAGER_H_
OLDNEW
« no previous file with comments | « services/ui/public/cpp/gpu/gpu_service.cc ('k') | services/ui/public/cpp/gpu/mojo_gpu_memory_buffer_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698