diff --git a/content_handler/app.cc b/content_handler/app.cc index dbcb061d863a3192ec9b25e60e3702fee6ad1d2c..a55c73aeb75baebed7a48be801a68c143296dd12 100644 --- a/content_handler/app.cc +++ b/content_handler/app.cc @@ -7,6 +7,7 @@ #include #include +#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 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