Skip to content

Commit

Permalink
Merge branch 'main' into jarred/fix-leak
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarred-Sumner committed Jan 25, 2025
2 parents e4f3122 + 0768baf commit fbcc4f7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions .buildkite/ci.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ function getBuildZigStep(platform, options) {
cancel_on_build_failing: isMergeQueue(),
env: getBuildEnv(platform, options),
command: `bun run build:ci --target bun-zig --toolchain ${toolchain}`,
timeout_in_minutes: 25,
};
}

Expand Down
11 changes: 9 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub fn getCpuModel(os: OperatingSystem, arch: Arch) ?Target.Query.CpuModel {

pub fn build(b: *Build) !void {
std.log.info("zig compiler v{s}", .{builtin.zig_version_string});
checked_file_exists = std.AutoHashMap(u64, void).init(b.allocator);

b.zig_lib_dir = b.zig_lib_dir orelse b.path("vendor/zig/lib");

Expand Down Expand Up @@ -481,9 +482,15 @@ pub fn addInstallObjectFile(
}, b.fmt("{s}.o", .{name})).step;
}

var checked_file_exists: std.AutoHashMap(u64, void) = undefined;
fn exists(path: []const u8) bool {
const file = std.fs.openFileAbsolute(path, .{ .mode = .read_only }) catch return false;
file.close();
const entry = checked_file_exists.getOrPut(std.hash.Wyhash.hash(0, path)) catch unreachable;
if (entry.found_existing) {
// It would've panicked.
return true;
}

std.fs.accessAbsolute(path, .{ .mode = .read_only }) catch return false;
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion src/bun.js/bindings/webcore/AbortSignal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ void AbortSignal::cleanNativeBindings(void* ref)
});

std::exchange(m_native_callbacks, WTFMove(callbacks));
this->eventListenersDidChange();
}

// https://dom.spec.whatwg.org/#abortsignal-follow
Expand All @@ -218,7 +219,7 @@ void AbortSignal::signalFollow(AbortSignal& signal)

void AbortSignal::eventListenersDidChange()
{
m_hasAbortEventListener = hasEventListeners(eventNames().abortEvent);
m_hasAbortEventListener = hasEventListeners(eventNames().abortEvent) or !m_native_callbacks.isEmpty();
}

uint32_t AbortSignal::addAbortAlgorithmToSignal(AbortSignal& signal, Ref<AbortAlgorithm>&& algorithm)
Expand Down

0 comments on commit fbcc4f7

Please sign in to comment.