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

Side by Side Diff: components/mus/public/cpp/lib/command_buffer_client_impl.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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
(Empty)
1 // Copyright 2014 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 COMPONENTS_MUS_PUBLIC_CPP_LIB_COMMAND_BUFFER_CLIENT_IMPL_H_
6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_COMMAND_BUFFER_CLIENT_IMPL_H_
7
8 #include <stddef.h>
9 #include <stdint.h>
10
11 #include <map>
12 #include <memory>
13 #include <vector>
14
15 #include "base/macros.h"
16 #include "components/mus/public/interfaces/command_buffer.mojom.h"
17 #include "gpu/command_buffer/client/gpu_control.h"
18 #include "gpu/command_buffer/common/command_buffer.h"
19 #include "gpu/command_buffer/common/command_buffer_id.h"
20 #include "gpu/command_buffer/common/command_buffer_shared.h"
21 #include "mojo/public/cpp/bindings/binding.h"
22
23 namespace base {
24 class RunLoop;
25 }
26
27 namespace mus {
28 class CommandBufferClientImpl;
29
30 class CommandBufferClientImpl : public mus::mojom::CommandBufferClient,
31 public gpu::CommandBuffer,
32 public gpu::GpuControl {
33 public:
34 explicit CommandBufferClientImpl(
35 const std::vector<int32_t>& attribs,
36 mus::mojom::CommandBufferPtr command_buffer_ptr);
37 ~CommandBufferClientImpl() override;
38 bool Initialize();
39
40 // CommandBuffer implementation:
41 State GetLastState() override;
42 int32_t GetLastToken() override;
43 void Flush(int32_t put_offset) override;
44 void OrderingBarrier(int32_t put_offset) override;
45 void WaitForTokenInRange(int32_t start, int32_t end) override;
46 void WaitForGetOffsetInRange(int32_t start, int32_t end) override;
47 void SetGetBuffer(int32_t shm_id) override;
48 scoped_refptr<gpu::Buffer> CreateTransferBuffer(size_t size,
49 int32_t* id) override;
50 void DestroyTransferBuffer(int32_t id) override;
51
52 // gpu::GpuControl implementation:
53 void SetGpuControlClient(gpu::GpuControlClient*) override;
54 gpu::Capabilities GetCapabilities() override;
55 int32_t CreateImage(ClientBuffer buffer,
56 size_t width,
57 size_t height,
58 unsigned internalformat) override;
59 void DestroyImage(int32_t id) override;
60 int32_t CreateGpuMemoryBufferImage(size_t width,
61 size_t height,
62 unsigned internalformat,
63 unsigned usage) override;
64 int32_t GetImageGpuMemoryBufferId(unsigned image_id) override;
65 void SignalQuery(uint32_t query, const base::Closure& callback) override;
66 void SetLock(base::Lock*) override;
67 void EnsureWorkVisible() override;
68 gpu::CommandBufferNamespace GetNamespaceID() const override;
69 gpu::CommandBufferId GetCommandBufferID() const override;
70 int32_t GetExtraCommandBufferData() const override;
71 uint64_t GenerateFenceSyncRelease() override;
72 bool IsFenceSyncRelease(uint64_t release) override;
73 bool IsFenceSyncFlushed(uint64_t release) override;
74 bool IsFenceSyncFlushReceived(uint64_t release) override;
75 void SignalSyncToken(const gpu::SyncToken& sync_token,
76 const base::Closure& callback) override;
77 bool CanWaitUnverifiedSyncToken(const gpu::SyncToken* sync_token) override;
78
79 private:
80 // mus::mojom::CommandBufferClient implementation:
81 void Destroyed(int32_t lost_reason, int32_t error) override;
82 void SignalAck(uint32_t id) override;
83 void SwapBuffersCompleted(int32_t result) override;
84 void UpdateState(const gpu::CommandBuffer::State& state) override;
85 void UpdateVSyncParameters(int64_t timebase, int64_t interval) override;
86
87 void TryUpdateState();
88 void MakeProgressAndUpdateState();
89
90 gpu::CommandBufferSharedState* shared_state() const {
91 return reinterpret_cast<gpu::CommandBufferSharedState*>(
92 shared_state_.get());
93 }
94
95 gpu::GpuControlClient* gpu_control_client_;
96 bool destroyed_;
97 std::vector<int32_t> attribs_;
98 mojo::Binding<mus::mojom::CommandBufferClient> client_binding_;
99 mus::mojom::CommandBufferPtr command_buffer_;
100
101 gpu::CommandBufferId command_buffer_id_;
102 gpu::Capabilities capabilities_;
103 State last_state_;
104 mojo::ScopedSharedBufferMapping shared_state_;
105 int32_t last_put_offset_;
106 int32_t next_transfer_buffer_id_;
107
108 // Image IDs are allocated in sequence.
109 int next_image_id_;
110
111 uint64_t next_fence_sync_release_;
112 uint64_t flushed_fence_sync_release_;
113 };
114
115 } // mus
116
117 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_COMMAND_BUFFER_CLIENT_IMPL_H_
OLDNEW
« no previous file with comments | « components/mus/public/cpp/lib/DEPS ('k') | components/mus/public/cpp/lib/command_buffer_client_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698