Enable automatic native checkpoints and browser preview
This commit is contained in:
1 parent
bb1a166c4c
commit
06463399bb
10 files changed
+877
-92
No files matched your search
@@ -183,6 +183,7 @@ pub struct Executor {
|
||||
split_discards: Vec<NativeVerticalNode>,
|
||||
output_frame: Option<page::OutputFrame>,
|
||||
pending_shipouts: VecDeque<NativeBox>,
|
||||
shipped_pages: usize,
|
||||
job_ended: bool,
|
||||
fresh_job: bool,
|
||||
job_name: Option<String>,
|
||||
@@ -306,6 +307,7 @@ impl Executor {
|
||||
split_discards: Vec::new(),
|
||||
output_frame: None,
|
||||
pending_shipouts: VecDeque::new(),
|
||||
shipped_pages: 0,
|
||||
job_ended: false,
|
||||
fresh_job: true,
|
||||
job_name: None,
|
||||
@@ -2939,7 +2941,7 @@ impl Executor {
|
||||
/// Capture the first eligible entry command boundary at or beyond the
|
||||
/// requested physical byte. The callback captures the matching host state.
|
||||
pub fn run_capturing_entry<F: SourceProvider, H>(
|
||||
mut self,
|
||||
self,
|
||||
file: SourceFile,
|
||||
files: &mut F,
|
||||
minimum_frontier: usize,
|
||||
@@ -2948,11 +2950,38 @@ impl Executor {
|
||||
Result<Execution, ExecutionFailure>,
|
||||
Option<(EntryCheckpoint, H)>,
|
||||
) {
|
||||
let incoming_state = self.state.fingerprint();
|
||||
let mut requested = false;
|
||||
let mut capture_host = Some(capture_host);
|
||||
let mut captured = None;
|
||||
let result = self.run_capturing_entries(
|
||||
file,
|
||||
files,
|
||||
|frontier, _| {
|
||||
if requested || frontier < minimum_frontier {
|
||||
return None;
|
||||
}
|
||||
requested = true;
|
||||
Some(())
|
||||
},
|
||||
|(), checkpoint, files| {
|
||||
captured = Some((checkpoint, capture_host.take().unwrap()(files)));
|
||||
},
|
||||
);
|
||||
(result, captured)
|
||||
}
|
||||
|
||||
/// Observe eligible boundaries during normal execution. Only clone the
|
||||
/// state when the caller selects a boundary, giving it its matching host.
|
||||
pub fn run_capturing_entries<F: SourceProvider, S>(
|
||||
mut self,
|
||||
file: SourceFile,
|
||||
files: &mut F,
|
||||
mut select: impl FnMut(usize, usize) -> Option<S>,
|
||||
mut capture: impl FnMut(S, EntryCheckpoint, &mut F),
|
||||
) -> Result<Execution, ExecutionFailure> {
|
||||
let incoming_state = self.state.fingerprint();
|
||||
let result = self.run_observed(file, files, |engine, initial_depth, files| {
|
||||
if capture_host.is_none() || engine.job_ended {
|
||||
if engine.job_ended {
|
||||
return;
|
||||
}
|
||||
let Some(InputFrame::Source {
|
||||
@@ -2970,16 +2999,20 @@ impl Executor {
|
||||
};
|
||||
// Keep the active macro and argument cursors, but a second
|
||||
// physical source would have an independent unread frontier.
|
||||
if frontier < minimum_frontier
|
||||
|| engine.inputs[1..]
|
||||
.iter()
|
||||
.any(|frame| matches!(frame, InputFrame::Source { .. }))
|
||||
|| engine.sources.iter().enumerate().any(|(index, other)| {
|
||||
index != *source && other.name == engine.sources[*source].name
|
||||
})
|
||||
if engine.inputs[1..]
|
||||
.iter()
|
||||
.any(|frame| matches!(frame, InputFrame::Source { .. }))
|
||||
{
|
||||
return;
|
||||
}
|
||||
let Some(slot) = select(frontier, engine.shipped_pages) else {
|
||||
return;
|
||||
};
|
||||
if engine.sources.iter().enumerate().any(|(index, other)| {
|
||||
index != *source && other.name == engine.sources[*source].name
|
||||
}) {
|
||||
return;
|
||||
}
|
||||
let mut executor = engine.clone();
|
||||
executor.cancellation = None;
|
||||
executor.line_break_cache = None;
|
||||
@@ -2990,9 +3023,9 @@ impl Executor {
|
||||
incoming_state,
|
||||
frontier,
|
||||
};
|
||||
captured = Some((checkpoint, capture_host.take().unwrap()(files)));
|
||||
capture(slot, checkpoint, files);
|
||||
});
|
||||
(self.finish_execution(result, incoming_state), captured)
|
||||
self.finish_execution(result, incoming_state)
|
||||
}
|
||||
fn finish_execution(
|
||||
mut self,
|
||||
|
||||
Reference in new issue
Block a user