Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit e893457

Browse files
author
John Bauman
authored
Set debug client info for sysmem allocator (#24384)
1 parent cfa1b8e commit e893457

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

shell/platform/fuchsia/flutter/vulkan_surface_pool.cc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include "vulkan_surface_pool.h"
66

77
#include <lib/fdio/directory.h>
8+
#include <lib/zx/process.h>
89

910
#include <algorithm>
1011
#include <string>
@@ -14,6 +15,20 @@
1415

1516
namespace flutter_runner {
1617

18+
static std::string GetCurrentProcessName() {
19+
char name[ZX_MAX_NAME_LEN];
20+
zx_status_t status =
21+
zx::process::self()->get_property(ZX_PROP_NAME, name, sizeof(name));
22+
return status == ZX_OK ? std::string(name) : std::string();
23+
}
24+
25+
static zx_koid_t GetCurrentProcessId() {
26+
zx_info_handle_basic_t info;
27+
zx_status_t status = zx::process::self()->get_info(
28+
ZX_INFO_HANDLE_BASIC, &info, sizeof(info), nullptr, nullptr);
29+
return status == ZX_OK ? info.koid : ZX_KOID_INVALID;
30+
}
31+
1732
VulkanSurfacePool::VulkanSurfacePool(vulkan::VulkanProvider& vulkan_provider,
1833
sk_sp<GrDirectContext> context,
1934
scenic::Session* scenic_session)
@@ -23,6 +38,8 @@ VulkanSurfacePool::VulkanSurfacePool(vulkan::VulkanProvider& vulkan_provider,
2338
zx_status_t status = fdio_service_connect(
2439
"/svc/fuchsia.sysmem.Allocator",
2540
sysmem_allocator_.NewRequest().TakeChannel().release());
41+
sysmem_allocator_->SetDebugClientInfo(GetCurrentProcessName(),
42+
GetCurrentProcessId());
2643
FML_DCHECK(status != ZX_OK);
2744
}
2845

0 commit comments

Comments
 (0)