| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_H_ | 5 #ifndef COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_H_ |
| 6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_H_ | 6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
| 13 #include "base/threading/thread.h" | 13 #include "base/threading/thread.h" |
| 14 #include "gpu/ipc/client/gpu_channel_host.h" | 14 #include "gpu/ipc/client/gpu_channel_host.h" |
| 15 | 15 |
| 16 namespace shell { | 16 namespace shell { |
| 17 class Connector; | 17 class Connector; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace mus { | 20 namespace mus { |
| 21 | 21 |
| 22 class GpuMemoryBufferManagerMus; | 22 class MojoGpuMemoryBufferManager; |
| 23 | 23 |
| 24 class GpuService : public gpu::GpuChannelHostFactory { | 24 class GpuService : public gpu::GpuChannelHostFactory { |
| 25 public: | 25 public: |
| 26 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannel( | 26 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannel( |
| 27 shell::Connector* connector); | 27 shell::Connector* connector); |
| 28 | 28 |
| 29 static bool UseChromeGpuCommandBuffer(); | 29 static bool UseChromeGpuCommandBuffer(); |
| 30 static GpuService* GetInstance(); | 30 static GpuService* GetInstance(); |
| 31 | 31 |
| 32 private: | 32 private: |
| 33 friend struct base::DefaultSingletonTraits<GpuService>; | 33 friend struct base::DefaultSingletonTraits<GpuService>; |
| 34 | 34 |
| 35 GpuService(); | 35 GpuService(); |
| 36 ~GpuService() override; | 36 ~GpuService() override; |
| 37 | 37 |
| 38 // gpu::GpuChannelHostFactory overrides: | 38 // gpu::GpuChannelHostFactory overrides: |
| 39 bool IsMainThread() override; | 39 bool IsMainThread() override; |
| 40 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; | 40 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; |
| 41 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( | 41 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( |
| 42 size_t size) override; | 42 size_t size) override; |
| 43 | 43 |
| 44 base::MessageLoop* main_message_loop_; | 44 base::MessageLoop* main_message_loop_; |
| 45 base::WaitableEvent shutdown_event_; | 45 base::WaitableEvent shutdown_event_; |
| 46 base::Thread io_thread_; | 46 base::Thread io_thread_; |
| 47 std::unique_ptr<GpuMemoryBufferManagerMus> gpu_memory_buffer_manager_; | 47 std::unique_ptr<MojoGpuMemoryBufferManager> gpu_memory_buffer_manager_; |
| 48 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; | 48 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; |
| 49 | 49 |
| 50 DISALLOW_COPY_AND_ASSIGN(GpuService); | 50 DISALLOW_COPY_AND_ASSIGN(GpuService); |
| 51 }; | 51 }; |
| 52 | 52 |
| 53 } // namespace mus | 53 } // namespace mus |
| 54 | 54 |
| 55 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_CONNECTION_H_ | 55 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_CONNECTION_H_ |
| OLD | NEW |