OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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_GPU_SERVICE_H_ |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_GPU_SERVICE_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 #include <vector> |
| 10 |
| 11 #include "base/callback.h" |
| 12 #include "base/lazy_instance.h" |
| 13 #include "base/macros.h" |
| 14 #include "base/observer_list.h" |
| 15 #include "base/synchronization/waitable_event.h" |
| 16 #include "base/threading/thread.h" |
| 17 #include "components/mus/common/types.h" |
| 18 #include "components/mus/public/cpp/mus_public_export.h" |
| 19 #include "components/mus/public/interfaces/mus_constants.mojom.h" |
| 20 #include "components/mus/public/interfaces/surface_id.mojom.h" |
| 21 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 22 #include "gpu/ipc/client/gpu_channel_host.h" |
| 23 #include "mojo/public/cpp/bindings/array.h" |
| 24 #include "services/shell/public/interfaces/interface_provider.mojom.h" |
| 25 #include "ui/gfx/geometry/insets.h" |
| 26 #include "ui/gfx/geometry/rect.h" |
| 27 |
| 28 namespace shell { |
| 29 class Connector; |
| 30 } |
| 31 |
| 32 namespace mus { |
| 33 |
| 34 class GpuMemoryBufferManagerMus; |
| 35 |
| 36 class MUS_PUBLIC_EXPORT GpuService : public gpu::GpuChannelHostFactory { |
| 37 public: |
| 38 GpuService(); |
| 39 ~GpuService() override; |
| 40 |
| 41 scoped_refptr<gpu::GpuChannelHost> gpu_channel_host() { return gpu_channel_; } |
| 42 |
| 43 static bool UseChromeGpuCommandBuffer(); |
| 44 static void Initialize(shell::Connector* connector); |
| 45 static GpuService* GetInstance(); |
| 46 |
| 47 private: |
| 48 void Init(shell::Connector* connector); |
| 49 |
| 50 // gpu::GpuChannelHostFactory overrides: |
| 51 bool IsMainThread() override; |
| 52 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; |
| 53 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( |
| 54 size_t size) override; |
| 55 |
| 56 bool initialized_; |
| 57 base::MessageLoop* main_message_loop_; |
| 58 base::WaitableEvent shutdown_event_; |
| 59 base::Thread io_thread_; |
| 60 std::unique_ptr<GpuMemoryBufferManagerMus> gpu_memory_buffer_manager_; |
| 61 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; |
| 62 }; |
| 63 |
| 64 } // namespace mus |
| 65 |
| 66 #endif // COMPONENTS_MUS_PUBLIC_CPP_GPU_SERVICE_CONNECTION_H_ |
OLD | NEW |