Enable automatic native checkpoints and browser preview

This commit is contained in:
gloamxun committed 2026-11-19 10:05:41 +08:00
1 parent bb1a166c4c
commit 06463399bb
10 files changed
+877 -92

No files matched your search

+13 -2
View File
@@ -26,8 +26,20 @@ impl<'a> RecordingHost<'a> {
}
}
#[cfg(test)]
pub(super) fn capture(&mut self) -> Option<(Vec<Call>, ResourceTrace)> {
Some((self.calls.take()?, self.files.resource_trace().clone()))
let (trace, _) = self.prefix()?;
let trace = trace.clone();
Some((self.calls.take()?, trace))
}
pub(super) fn prefix(&self) -> Option<(&ResourceTrace, usize)> {
let count = self.calls.as_ref()?.len();
(count < MAX_REPLAY_CALLS).then(|| (self.files.resource_trace(), count))
}
pub(super) fn into_calls(self) -> Option<Vec<Call>> {
self.calls
}
fn record<T, K: Debug + PartialEq + Send + Sync + 'static>(
@@ -39,7 +51,6 @@ impl<'a> RecordingHost<'a> {
let result = call(self.files);
if let Some(calls) = &mut self.calls {
if calls.len() == MAX_REPLAY_CALLS {
self.calls = None;
return result;
}
let expected = evidence(&result);