• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   };
23 
24   std::unique_ptr<fml::Thread> platform_thread;
25   std::unique_ptr<fml::Thread> ui_thread;
26   std::unique_ptr<fml::Thread> gpu_thread;
27   std::unique_ptr<fml::Thread> io_thread;
28 
29   ThreadHost();
30 
31   ThreadHost(ThreadHost&&);
32 
33   ThreadHost& operator=(ThreadHost&&) = default;
34 
35   ThreadHost(std::string name_prefix, uint64_t type_mask);
36 
37   ~ThreadHost();
38 
39   void Reset();
40 };
41 
42 }  // namespace flutter
43 
44 #endif  // FLUTTER_SHELL_COMMON_THREAD_HOST_H_
45