2018-11-07 12:24:35 -08:00
|
|
|
// Copyright 2013 The Flutter Authors. All rights reserved.
|
2018-04-13 13:48:15 -07:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
|
|
|
|
|
#include "flutter/shell/common/thread_host.h"
|
|
|
|
|
|
2019-04-09 17:10:46 -07:00
|
|
|
namespace flutter {
|
2018-04-13 13:48:15 -07:00
|
|
|
|
|
|
|
|
ThreadHost::ThreadHost() = default;
|
|
|
|
|
|
2018-11-12 19:59:29 -08:00
|
|
|
ThreadHost::ThreadHost(ThreadHost&&) = default;
|
|
|
|
|
|
2018-04-13 13:48:15 -07:00
|
|
|
ThreadHost::ThreadHost(std::string name_prefix, uint64_t mask) {
|
|
|
|
|
if (mask & ThreadHost::Type::Platform) {
|
|
|
|
|
platform_thread = std::make_unique<fml::Thread>(name_prefix + ".platform");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mask & ThreadHost::Type::UI) {
|
|
|
|
|
ui_thread = std::make_unique<fml::Thread>(name_prefix + ".ui");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mask & ThreadHost::Type::GPU) {
|
|
|
|
|
gpu_thread = std::make_unique<fml::Thread>(name_prefix + ".gpu");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (mask & ThreadHost::Type::IO) {
|
|
|
|
|
io_thread = std::make_unique<fml::Thread>(name_prefix + ".io");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ThreadHost::~ThreadHost() = default;
|
|
|
|
|
|
|
|
|
|
void ThreadHost::Reset() {
|
|
|
|
|
platform_thread.reset();
|
|
|
|
|
ui_thread.reset();
|
|
|
|
|
gpu_thread.reset();
|
|
|
|
|
io_thread.reset();
|
|
|
|
|
}
|
|
|
|
|
|
2019-04-09 17:10:46 -07:00
|
|
|
} // namespace flutter
|