From 822182154d6f7f6b6337ca9c75acdc4cb62daea0 Mon Sep 17 00:00:00 2001 From: John Bauman Date: Thu, 18 Feb 2021 16:46:02 -0600 Subject: [PATCH] Set debug client info for sysmem allocator (flutter/engine#24384) --- .../fuchsia/flutter/vulkan_surface_pool.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_pool.cc b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_pool.cc index bd3ffb4810..b9f83e8eab 100644 --- a/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_pool.cc +++ b/engine/src/flutter/shell/platform/fuchsia/flutter/vulkan_surface_pool.cc @@ -5,6 +5,7 @@ #include "vulkan_surface_pool.h" #include +#include #include #include @@ -14,6 +15,20 @@ namespace flutter_runner { +static std::string GetCurrentProcessName() { + char name[ZX_MAX_NAME_LEN]; + zx_status_t status = + zx::process::self()->get_property(ZX_PROP_NAME, name, sizeof(name)); + return status == ZX_OK ? std::string(name) : std::string(); +} + +static zx_koid_t GetCurrentProcessId() { + zx_info_handle_basic_t info; + zx_status_t status = zx::process::self()->get_info( + ZX_INFO_HANDLE_BASIC, &info, sizeof(info), nullptr, nullptr); + return status == ZX_OK ? info.koid : ZX_KOID_INVALID; +} + VulkanSurfacePool::VulkanSurfacePool(vulkan::VulkanProvider& vulkan_provider, sk_sp context, scenic::Session* scenic_session) @@ -23,6 +38,8 @@ VulkanSurfacePool::VulkanSurfacePool(vulkan::VulkanProvider& vulkan_provider, zx_status_t status = fdio_service_connect( "/svc/fuchsia.sysmem.Allocator", sysmem_allocator_.NewRequest().TakeChannel().release()); + sysmem_allocator_->SetDebugClientInfo(GetCurrentProcessName(), + GetCurrentProcessId()); FML_DCHECK(status != ZX_OK); }