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_LIB_GPU_SERVICE_H_ | |
6 #define COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_H_ | |
7 | |
8 #include <stdint.h> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 #include "base/synchronization/waitable_event.h" | |
13 #include "base/threading/thread.h" | |
14 #include "gpu/ipc/client/gpu_channel_host.h" | |
15 | |
16 namespace shell { | |
17 class Connector; | |
18 } | |
19 | |
20 namespace mus { | |
21 | |
22 class GpuMemoryBufferManagerMus; | |
23 | |
24 class GpuService : public gpu::GpuChannelHostFactory { | |
25 public: | |
26 scoped_refptr<gpu::GpuChannelHost> EstablishGpuChannel( | |
27 shell::Connector* connector); | |
28 | |
29 static bool UseChromeGpuCommandBuffer(); | |
30 static GpuService* GetInstance(); | |
31 | |
32 private: | |
33 friend struct base::DefaultSingletonTraits<GpuService>; | |
34 | |
35 GpuService(); | |
36 ~GpuService() override; | |
37 | |
38 // gpu::GpuChannelHostFactory overrides: | |
39 bool IsMainThread() override; | |
40 scoped_refptr<base::SingleThreadTaskRunner> GetIOThreadTaskRunner() override; | |
41 std::unique_ptr<base::SharedMemory> AllocateSharedMemory( | |
42 size_t size) override; | |
43 | |
44 base::MessageLoop* main_message_loop_; | |
45 base::WaitableEvent shutdown_event_; | |
46 base::Thread io_thread_; | |
47 std::unique_ptr<GpuMemoryBufferManagerMus> gpu_memory_buffer_manager_; | |
48 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; | |
49 | |
50 DISALLOW_COPY_AND_ASSIGN(GpuService); | |
51 }; | |
52 | |
53 } // namespace mus | |
54 | |
55 #endif // COMPONENTS_MUS_PUBLIC_CPP_LIB_GPU_SERVICE_CONNECTION_H_ | |
OLD | NEW |