mirror of
https://github.com/servo/servo.git
synced 2025-08-05 05:30:08 +01:00
profile: Simplify profiler's find or insert code.
This commit is contained in:
parent
cc262c641f
commit
ed87fcf6cf
1 changed files with 1 additions and 6 deletions
|
@ -296,12 +296,7 @@ impl Profiler {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn find_or_insert(&mut self, k: (ProfilerCategory, Option<TimerMetadata>), t: f64) {
|
fn find_or_insert(&mut self, k: (ProfilerCategory, Option<TimerMetadata>), t: f64) {
|
||||||
match self.buckets.get_mut(&k) {
|
self.buckets.entry(k).or_insert_with(Vec::new).push(t);
|
||||||
None => {},
|
|
||||||
Some(v) => { v.push(t); return; },
|
|
||||||
}
|
|
||||||
|
|
||||||
self.buckets.insert(k, vec!(t));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_msg(&mut self, msg: ProfilerMsg) -> bool {
|
fn handle_msg(&mut self, msg: ProfilerMsg) -> bool {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue