mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-04-02 10:19:17 +00:00
Compare commits
5 Commits
websocket
...
abort_asse
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
de0a04a58e | ||
|
|
38fa9602fa | ||
|
|
9661204c8d | ||
|
|
6800e53b0e | ||
|
|
3aeba97fc9 |
33
build.zig
33
build.zig
@@ -46,8 +46,12 @@ pub fn build(b: *Build) !void {
|
|||||||
var stdout = std.fs.File.stdout().writer(&.{});
|
var stdout = std.fs.File.stdout().writer(&.{});
|
||||||
try stdout.interface.print("Lightpanda {f}\n", .{version});
|
try stdout.interface.print("Lightpanda {f}\n", .{version});
|
||||||
|
|
||||||
|
const version_string = b.fmt("{f}", .{version});
|
||||||
|
const version_encoded = std.mem.replaceOwned(u8, b.allocator, version_string, "+", "%2B") catch @panic("OOM");
|
||||||
|
|
||||||
var opts = b.addOptions();
|
var opts = b.addOptions();
|
||||||
opts.addOption([]const u8, "version", b.fmt("{f}", .{version}));
|
opts.addOption([]const u8, "version", version_string);
|
||||||
|
opts.addOption([]const u8, "version_encoded", version_encoded);
|
||||||
opts.addOption(?[]const u8, "snapshot_path", snapshot_path);
|
opts.addOption(?[]const u8, "snapshot_path", snapshot_path);
|
||||||
|
|
||||||
const enable_tsan = b.option(bool, "tsan", "Enable Thread Sanitizer") orelse false;
|
const enable_tsan = b.option(bool, "tsan", "Enable Thread Sanitizer") orelse false;
|
||||||
@@ -85,6 +89,15 @@ pub fn build(b: *Build) !void {
|
|||||||
break :blk mod;
|
break :blk mod;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Check compilation
|
||||||
|
const check = b.step("check", "Check if lightpanda compiles");
|
||||||
|
|
||||||
|
const check_lib = b.addLibrary(.{
|
||||||
|
.name = "lightpanda_check",
|
||||||
|
.root_module = lightpanda_module,
|
||||||
|
});
|
||||||
|
check.dependOn(&check_lib.step);
|
||||||
|
|
||||||
{
|
{
|
||||||
// browser
|
// browser
|
||||||
const exe = b.addExecutable(.{
|
const exe = b.addExecutable(.{
|
||||||
@@ -103,6 +116,12 @@ pub fn build(b: *Build) !void {
|
|||||||
});
|
});
|
||||||
b.installArtifact(exe);
|
b.installArtifact(exe);
|
||||||
|
|
||||||
|
const exe_check = b.addLibrary(.{
|
||||||
|
.name = "lightpanda_exe_check",
|
||||||
|
.root_module = exe.root_module,
|
||||||
|
});
|
||||||
|
check.dependOn(&exe_check.step);
|
||||||
|
|
||||||
const run_cmd = b.addRunArtifact(exe);
|
const run_cmd = b.addRunArtifact(exe);
|
||||||
if (b.args) |args| {
|
if (b.args) |args| {
|
||||||
run_cmd.addArgs(args);
|
run_cmd.addArgs(args);
|
||||||
@@ -132,6 +151,12 @@ pub fn build(b: *Build) !void {
|
|||||||
});
|
});
|
||||||
b.installArtifact(exe);
|
b.installArtifact(exe);
|
||||||
|
|
||||||
|
const exe_check = b.addLibrary(.{
|
||||||
|
.name = "snapshot_creator_check",
|
||||||
|
.root_module = exe.root_module,
|
||||||
|
});
|
||||||
|
check.dependOn(&exe_check.step);
|
||||||
|
|
||||||
const run_cmd = b.addRunArtifact(exe);
|
const run_cmd = b.addRunArtifact(exe);
|
||||||
if (b.args) |args| {
|
if (b.args) |args| {
|
||||||
run_cmd.addArgs(args);
|
run_cmd.addArgs(args);
|
||||||
@@ -170,6 +195,12 @@ pub fn build(b: *Build) !void {
|
|||||||
});
|
});
|
||||||
b.installArtifact(exe);
|
b.installArtifact(exe);
|
||||||
|
|
||||||
|
const exe_check = b.addLibrary(.{
|
||||||
|
.name = "legacy_test_check",
|
||||||
|
.root_module = exe.root_module,
|
||||||
|
});
|
||||||
|
check.dependOn(&exe_check.step);
|
||||||
|
|
||||||
const run_cmd = b.addRunArtifact(exe);
|
const run_cmd = b.addRunArtifact(exe);
|
||||||
if (b.args) |args| {
|
if (b.args) |args| {
|
||||||
run_cmd.addArgs(args);
|
run_cmd.addArgs(args);
|
||||||
|
|||||||
@@ -235,10 +235,6 @@ fn _abort(self: *Client, comptime abort_all: bool, frame_id: u32) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comptime IS_DEBUG and abort_all) {
|
|
||||||
std.debug.assert(self.active == 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
{
|
||||||
var q = &self.queue;
|
var q = &self.queue;
|
||||||
var n = q.first;
|
var n = q.first;
|
||||||
@@ -259,12 +255,16 @@ fn _abort(self: *Client, comptime abort_all: bool, frame_id: u32) void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (comptime IS_DEBUG and abort_all) {
|
if (comptime IS_DEBUG and abort_all) {
|
||||||
std.debug.assert(self.in_use.first == null);
|
// Even after an abort_all, we could still have transfers, but, at the
|
||||||
|
// very least, they should all be flagged as aborted.
|
||||||
const running = self.handles.perform() catch |err| {
|
var it = self.in_use.first;
|
||||||
lp.assert(false, "multi perform in abort", .{ .err = err });
|
var leftover: usize = 0;
|
||||||
};
|
while (it) |node| : (it = node.next) {
|
||||||
std.debug.assert(running == 0);
|
const conn: *http.Connection = @fieldParentPtr("node", node);
|
||||||
|
std.debug.assert((Transfer.fromConnection(conn) catch unreachable).aborted);
|
||||||
|
leftover += 1;
|
||||||
|
}
|
||||||
|
std.debug.assert(self.active == leftover);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ fn report(reason: []const u8, begin_addr: usize, args: anytype) !void {
|
|||||||
var url_buffer: [4096]u8 = undefined;
|
var url_buffer: [4096]u8 = undefined;
|
||||||
const url = blk: {
|
const url = blk: {
|
||||||
var writer: std.Io.Writer = .fixed(&url_buffer);
|
var writer: std.Io.Writer = .fixed(&url_buffer);
|
||||||
try writer.print("https://crash.lightpanda.io/c?v={s}&r=", .{lp.build_config.version});
|
try writer.print("https://crash.lightpanda.io/c?v={s}&r=", .{lp.build_config.version_encoded});
|
||||||
for (reason) |b| {
|
for (reason) |b| {
|
||||||
switch (b) {
|
switch (b) {
|
||||||
'A'...'Z', 'a'...'z', '0'...'9', '-', '.', '_' => try writer.writeByte(b),
|
'A'...'Z', 'a'...'z', '0'...'9', '-', '.', '_' => try writer.writeByte(b),
|
||||||
|
|||||||
Reference in New Issue
Block a user