mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-10-29 23:23:28 +00:00
cdp: remove send sync
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -225,8 +225,7 @@ pub fn sendEvent(
|
|||||||
const resp = Resp{ .method = name, .params = params, .sessionId = sessionID };
|
const resp = Resp{ .method = name, .params = params, .sessionId = sessionID };
|
||||||
|
|
||||||
const event_msg = try stringify(alloc, resp);
|
const event_msg = try stringify(alloc, resp);
|
||||||
defer alloc.free(event_msg);
|
try server.sendAsync(ctx, event_msg);
|
||||||
try server.sendSync(ctx, event_msg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getParams(
|
fn getParams(
|
||||||
|
|||||||
@@ -331,8 +331,7 @@ fn navigate(
|
|||||||
.loaderId = ctx.state.loaderID,
|
.loaderId = ctx.state.loaderID,
|
||||||
};
|
};
|
||||||
const res = try result(alloc, msg.id, Resp, resp, msg.sessionID);
|
const res = try result(alloc, msg.id, Resp, resp, msg.sessionID);
|
||||||
defer alloc.free(res);
|
try server.sendAsync(ctx, res);
|
||||||
try server.sendSync(ctx, res);
|
|
||||||
|
|
||||||
// TODO: at this point do we need async the following actions to be async?
|
// TODO: at this point do we need async the following actions to be async?
|
||||||
|
|
||||||
|
|||||||
@@ -256,8 +256,7 @@ fn disposeBrowserContext(
|
|||||||
|
|
||||||
// output
|
// output
|
||||||
const res = try result(alloc, msg.id, null, .{}, null);
|
const res = try result(alloc, msg.id, null, .{}, null);
|
||||||
defer alloc.free(res);
|
try server.sendAsync(ctx, res);
|
||||||
try server.sendSync(ctx, res);
|
|
||||||
|
|
||||||
return error.DisposeBrowserContext;
|
return error.DisposeBrowserContext;
|
||||||
}
|
}
|
||||||
@@ -345,8 +344,7 @@ fn closeTarget(
|
|||||||
success: bool = true,
|
success: bool = true,
|
||||||
};
|
};
|
||||||
const res = try result(alloc, msg.id, Resp, Resp{}, null);
|
const res = try result(alloc, msg.id, Resp, Resp{}, null);
|
||||||
defer alloc.free(res);
|
try server.sendAsync(ctx, res);
|
||||||
try server.sendSync(ctx, res);
|
|
||||||
|
|
||||||
// Inspector.detached event
|
// Inspector.detached event
|
||||||
const InspectorDetached = struct {
|
const InspectorDetached = struct {
|
||||||
|
|||||||
@@ -336,9 +336,8 @@ pub const Ctx = struct {
|
|||||||
tpl,
|
tpl,
|
||||||
.{ msg_open, cdp.ContextSessionID },
|
.{ msg_open, cdp.ContextSessionID },
|
||||||
);
|
);
|
||||||
defer ctx.alloc().free(s);
|
|
||||||
|
|
||||||
try sendSync(ctx, s);
|
try sendAsync(ctx, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn onInspectorResp(ctx_opaque: *anyopaque, _: u32, msg: []const u8) void {
|
pub fn onInspectorResp(ctx_opaque: *anyopaque, _: u32, msg: []const u8) void {
|
||||||
@@ -401,10 +400,6 @@ pub fn sendAsync(ctx: *Ctx, msg: []const u8) !void {
|
|||||||
ctx.loop.io.send(*Send, sd, Send.asyncCbk, &sd.completion, ctx.conn_socket, msg);
|
ctx.loop.io.send(*Send, sd, Send.asyncCbk, &sd.completion, ctx.conn_socket, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sendSync(ctx: *Ctx, msg: []const u8) !void {
|
|
||||||
_ = try std.posix.write(ctx.conn_socket, msg);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Listen
|
// Listen
|
||||||
// ------
|
// ------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user