mirror of
https://github.com/encounter/engine.git
synced 2026-03-30 11:09:55 -07:00
Name flutter_runner processes after the app they're running (#3803)
Currently in `ps` all apps running under the Flutter content handler show up as `flutter_runner`. This makes them hard to identify. This change names the process after the final path component URL of the application that's launched, prefixed with "flutter:". In theory we could run more than one Flutter application in a single content handler process, but we don't right now. If we do this logic would have to change.
This commit is contained in:
@@ -25,6 +25,13 @@ void QuitMessageLoop() {
|
||||
mtl::MessageLoop::GetCurrent()->QuitNow();
|
||||
}
|
||||
|
||||
std::string GetLabelFromURL(const std::string& url) {
|
||||
size_t last_slash = url.rfind('/');
|
||||
if (last_slash == std::string::npos || last_slash + 1 == url.length())
|
||||
return url;
|
||||
return url.substr(last_slash + 1);
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
App::App() {
|
||||
@@ -116,6 +123,11 @@ void App::StartApplication(
|
||||
app::ApplicationPackagePtr application,
|
||||
app::ApplicationStartupInfoPtr startup_info,
|
||||
fidl::InterfaceRequest<app::ApplicationController> controller) {
|
||||
// Name this process after the url of the application being launched.
|
||||
std::string label =
|
||||
"flutter:" + GetLabelFromURL(startup_info->launch_info->url);
|
||||
mx::process::self().set_property(MX_PROP_NAME, label.c_str(), label.size());
|
||||
|
||||
std::unique_ptr<ApplicationControllerImpl> impl =
|
||||
std::make_unique<ApplicationControllerImpl>(this, std::move(application),
|
||||
std::move(startup_info),
|
||||
|
||||
Reference in New Issue
Block a user