Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Propagate previously registered scopes when creating GlobalFrameView #206

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion puffin/src/profile_view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,14 @@ impl Default for GlobalFrameView {
fn default() -> Self {
let view = Arc::new(parking_lot::Mutex::new(FrameView::default()));
let view_clone = view.clone();
let sink_id = crate::GlobalProfiler::lock().add_sink(Box::new(move |frame| {
let mut profiler = crate::GlobalProfiler::lock();
let sink_id = profiler.add_sink(Box::new(move |frame| {
view_clone.lock().add_frame(frame);
}));
// GlobalFrameView might be created after scope scopes were already created
// and our registered sink won't see them without prior propagation.
profiler.emit_scope_snapshot();

Self { sink_id, view }
}
}
Expand Down