1 | // Copyright 2013 The Flutter 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 FLUTTER_SHELL_COMMON_THREAD_HOST_H_ |
6 | #define FLUTTER_SHELL_COMMON_THREAD_HOST_H_ |
7 | |
8 | #include <memory> |
9 | |
10 | #include "flutter/fml/macros.h" |
11 | #include "flutter/fml/thread.h" |
12 | |
13 | namespace flutter { |
14 | |
15 | /// The collection of all the threads used by the engine. |
16 | struct ThreadHost { |
17 | enum Type { |
18 | Platform = 1 << 0, |
19 | UI = 1 << 1, |
20 | GPU = 1 << 2, |
21 | IO = 1 << 3, |
22 | Profiler = 1 << 4, |
23 | }; |
24 | |
25 | std::unique_ptr<fml::Thread> platform_thread; |
26 | std::unique_ptr<fml::Thread> ui_thread; |
27 | std::unique_ptr<fml::Thread> raster_thread; |
28 | std::unique_ptr<fml::Thread> io_thread; |
29 | std::unique_ptr<fml::Thread> profiler_thread; |
30 | |
31 | ThreadHost(); |
32 | |
33 | ThreadHost(ThreadHost&&); |
34 | |
35 | ThreadHost& operator=(ThreadHost&&) = default; |
36 | |
37 | ThreadHost(std::string name_prefix, uint64_t type_mask); |
38 | |
39 | ~ThreadHost(); |
40 | |
41 | void Reset(); |
42 | }; |
43 | |
44 | } // namespace flutter |
45 | |
46 | #endif // FLUTTER_SHELL_COMMON_THREAD_HOST_H_ |
47 | |