Index: components/mus/public/cpp/lib/gpu_service.h |
diff --git a/components/mus/public/cpp/lib/gpu_service.h b/components/mus/public/cpp/lib/gpu_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..571a3537c14dd1c9be8b8ab2effff36afb8d5ae1 |
--- /dev/null |
+++ b/components/mus/public/cpp/lib/gpu_service.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2016 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 COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_H_ |
+#define COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_H_ |
+ |
+#include <stdint.h> |
+#include <vector> |
+ |
+#include "base/macros.h" |
+#include "base/synchronization/waitable_event.h" |
+#include "base/threading/thread.h" |
+#include "gpu/ipc/client/gpu_channel_host.h" |
+ |
+namespace shell { |
+class Connector; |
+} |
+ |
+namespace mus { |
+ |
+class GpuMemoryBufferManagerMus; |
+ |
+class GpuService : public gpu::GpuChannelHostFactory { |
+ public: |
+ scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannel( |
+ shell::Connector* connector); |
+ |
+ static bool UseChromeGpuCommandBuffer(); |
+ static GpuService* GetInstance(); |
+ |
+ private: |
+ friend struct base::DefaultSingletonTraits<GpuService>; |
+ |
+ GpuService(); |
+ ~GpuService() override; |
+ |
+ // gpu::GpuChannelHostFactory overrides: |
+ bool IsMainThread() override; |
+ scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; |
+ std::unique_ptr<base::SharedMemory> AllocateSharedMemory( |
+ size_t size) override; |
+ |
+ base::MessageLoop* main_message_loop_; |
+ base::WaitableEvent shutdown_event_; |
+ base::Thread io_thread_; |
+ std::unique_ptr<GpuMemoryBufferManagerMus> gpu_memory_buffer_manager_; |
+ scoped_refptr<gpu::GpuChannelHost> gpu_channel_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(GpuService); |
+}; |
+ |
+} // namespace mus |
+ |
+#endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_CONNECTION_H_ |