more explicit arena pool debug parameter

This commit is contained in:
Karl Seguin
2026-01-19 22:43:00 +08:00
parent 3c0c75be10
commit 9f0c902030
2 changed files with 6 additions and 3 deletions

View File

@@ -356,10 +356,13 @@ pub fn getOrigin(self: *Page, allocator: Allocator) !?[]const u8 {
return try URL.getOrigin(allocator, self.url);
}
pub fn getArena(self: *Page, comptime owner: []const u8) !Allocator {
const GetArenaOpts = struct {
debug: []const u8,
};
pub fn getArena(self: *Page, comptime opts: GetArenaOpts) !Allocator {
const allocator = try self.arena_pool.acquire();
if (comptime IS_DEBUG) {
try self._arena_pool_leak_track.put(self.arena, @intFromPtr(allocator.ptr), owner);
try self._arena_pool_leak_track.put(self.arena, @intFromPtr(allocator.ptr), opts.debug);
}
return allocator;
}

View File

@@ -79,7 +79,7 @@ const ResponseType = enum {
};
pub fn init(page: *Page) !*XMLHttpRequest {
const arena = try page.getArena("XMLHttpRequest");
const arena = try page.getArena(.{.debug = "XMLHttpRequest"});
errdefer page.releaseArena(arena);
const xx = try page._factory.xhrEventTarget(XMLHttpRequest{