Index: services/ui/ws/gpu_client.h |
diff --git a/services/ui/ws/gpu_client.h b/services/ui/ws/gpu_client.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ac5f07292b23d2fe1859076bc803b9280cadf2ec |
--- /dev/null |
+++ b/services/ui/ws/gpu_client.h |
@@ -0,0 +1,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_ |