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#include "flutter/shell/common/thread_host.h"
6
7namespace flutter {
8
9ThreadHost::ThreadHost() = default;
10
11ThreadHost::ThreadHost(ThreadHost&&) = default;
12
13ThreadHost::ThreadHost(std::string name_prefix, uint64_t mask) {
14 if (mask & ThreadHost::Type::Platform) {
15 platform_thread = std::make_unique<fml::Thread>(name_prefix + ".platform");
16 }
17
18 if (mask & ThreadHost::Type::UI) {
19 ui_thread = std::make_unique<fml::Thread>(name_prefix + ".ui");
20 }
21
22 if (mask & ThreadHost::Type::GPU) {
23 raster_thread = std::make_unique<fml::Thread>(name_prefix + ".raster");
24 }
25
26 if (mask & ThreadHost::Type::IO) {
27 io_thread = std::make_unique<fml::Thread>(name_prefix + ".io");
28 }
29
30 if (mask & ThreadHost::Type::Profiler) {
31 profiler_thread = std::make_unique<fml::Thread>(name_prefix + ".profiler");
32 }
33}
34
35ThreadHost::~ThreadHost() = default;
36
37void ThreadHost::Reset() {
38 platform_thread.reset();
39 ui_thread.reset();
40 raster_thread.reset();
41 io_thread.reset();
42 profiler_thread.reset();
43}
44
45} // namespace flutter
46