提交 fa46eca4 编写于 作者: E Erik Gilling 提交者: GitHub

Set ui, io, and gpu thread names. (#4182)

上级 a91e7b0c
......@@ -7,6 +7,7 @@
#include <thread>
#include <utility>
#include "dart/runtime/include/dart_tools_api.h"
#include "flutter/common/settings.h"
#include "flutter/common/threads.h"
#include "flutter/sky/engine/platform/fonts/fuchsia/FontCacheFuchsia.h"
......@@ -24,6 +25,13 @@ void QuitMessageLoop() {
fsl::MessageLoop::GetCurrent()->QuitNow();
}
void SetThreadName(fxl::RefPtr<fxl::TaskRunner> runner, std::string name) {
runner->PostTask([name]() {
zx::thread::self().set_property(ZX_PROP_NAME, name.c_str(), name.size());
Dart_SetThreadName(name.c_str());
});
}
std::string GetLabelFromURL(const std::string& url) {
size_t last_slash = url.rfind('/');
if (last_slash == std::string::npos || last_slash + 1 == url.length())
......@@ -50,6 +58,10 @@ App::App() {
auto gpu_task_runner = gpu_thread_->TaskRunner();
auto io_task_runner = io_thread_->TaskRunner();
SetThreadName(ui_task_runner, "ui");
SetThreadName(gpu_task_runner, "gpu");
SetThreadName(io_task_runner, "io");
// Notice that the Platform and UI threads are actually the same.
blink::Threads::Set(blink::Threads(ui_task_runner, // Platform
gpu_task_runner, // GPU
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册