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 7 namespace flutter { 8 9 ThreadHost::ThreadHost() = default; 10 11 ThreadHost::ThreadHost(ThreadHost&&) = default; 12 ThreadHost(std::string name_prefix,uint64_t mask)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 gpu_thread = std::make_unique<fml::Thread>(name_prefix + ".gpu"); 24 } 25 26 if (mask & ThreadHost::Type::IO) { 27 io_thread = std::make_unique<fml::Thread>(name_prefix + ".io"); 28 } 29 } 30 31 ThreadHost::~ThreadHost() = default; 32 Reset()33void ThreadHost::Reset() { 34 platform_thread.reset(); 35 ui_thread.reset(); 36 gpu_thread.reset(); 37 io_thread.reset(); 38 } 39 40 } // namespace flutter 41