diff options
Diffstat (limited to 'core/Kind.zig')
| -rw-r--r-- | core/Kind.zig | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/core/Kind.zig b/core/Kind.zig index a624d7c6..9844369d 100644 --- a/core/Kind.zig +++ b/core/Kind.zig @@ -137,7 +137,7 @@ pub const Slot = struct { // jobs' inputs, its file's hash, a placeholder's record), and what // a frame makes (the thumb, the pointer, whether one was drawn: a // view's, never a step's). - .local = .{ "ops", "st", "gpa", "arena", "plain", "file", "opened", "reloads", "jobs", "record", "thumb_at", "thumb_span", "pointer", "painted", "over", "used" }, + .local = .{ "ops", "st", "gpa", "arena", "plain", "file", "opened", "reloads", "jobs", "record", "thumb_at", "thumb_span", "pointer", "painted", "over", "used", "draws" }, }; /// Its kind's code here; null in a placeholder (`live` false: its kind /// not in the registry, its record kept for the day it comes) or a @@ -199,6 +199,11 @@ pub const Slot = struct { /// whether a frame was painted since its last tick. pointer: u8 = 0, painted: bool = false, + /// The last of its draws' tokens (api.draw), each its own process's: a + /// draw is a frame's, and how many frames each process paints differs, + /// so it is in no digest; the copy holds it with the slot. A kind + /// keeping one in its state (PA_PLAIN) is caught at that call's digest. + draws: u32 = 0, /// Each view's facts (a hash of its pa_view) as `view` was last told /// them, 0 for none: a change tells it again. views: [views.max]u64 = @splat(0), @@ -299,7 +304,7 @@ pub fn reopen(p: ?*Pardes, id: usize, s: *Slot, bytes: ?[]const u8) bool { const prev = cl.begin("open"); if (p) |core| if (core.kinds.byName(s.nameOf())) |k| { // Its code: its library loaded at the first pane of its kind. - if (s.ops == null) s.ops = Addon.need(&core.kinds, k, &cl.refused); + if (s.ops == null) s.ops = Addon.need(&core.kinds, k, &cl.refused, core.opts.distrusted); // Its block made afresh by this open. if (core.kinds.kinds[k].caps.plain) { if (s.plain) |b| if (b.len > 0) s.gpa.free(b); @@ -980,7 +985,7 @@ const Call = struct { // Run here, it came out otherwise than the session's: it broke its // promise (PA_PLAIN), and the client joins again without it. if (cl.slot.ops != null and cl.slot.plain != null and tape.replaying() and o.state != state) { - pardes.Addon.distrust(cl.slot.nameOf()); + if (cl.p) |p| if (p.opts.distrusted) |d| d.add(cl.slot.nameOf()); var why: Buf(160) = .{}; tape.diverged(why.print("addon {s}: its state after {s} is not the session's (it breaks PA_PLAIN): the session's alone now", .{ cl.slot.nameOf(), cl.name })); } @@ -1215,8 +1220,8 @@ pub const api: c.pa_api = .{ heap.free(copy); return 0; }; - draw_tokens = (draw_tokens +% 1) & ~c.PA_DRAWN; - const token = c.PA_DRAWN | draw_tokens; + cl.slot.draws = (cl.slot.draws +% 1) & ~c.PA_DRAWN; + const token = c.PA_DRAWN | cl.slot.draws; j.* = .{ .gpa = heap, .pane = @intCast(cl.id), .serial = pane.serial, .token = token, .gen = cl.slot.gen, .ops = ops, .in = copy, .arena = .init(heap), .draw = p }; Addon.holdJob(ops, true); if (drawer) |d| if (d.go(d.ctx, j)) return token; @@ -1243,7 +1248,6 @@ pub const api: c.pa_api = .{ /// which post each back to its loop to land (host_io.KindJob.land); false, /// or none (a test's core), and it runs here at once. pub var drawer: ?struct { ctx: ?*anyopaque, go: *const fn (ctx: ?*anyopaque, j: *host_io.KindJob) bool } = null; -var draw_tokens: u32 = 0; /// Draws done, each kept for its pane's next paint (the loop's alone). var ready: std.ArrayListUnmanaged(*host_io.KindJob) = .empty; |
