mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Refactor the memory profiler code to return the struct. (#37155)
Refactor the memory profiler code to return the struct and handle the serializing in servointernal page. This allows other users of the memory profiler to see the whole report without parsing json. Testing: I do not know if the memory page is covered by tests. --------- Signed-off-by: Narfinger <Narfinger@users.noreply.github.com>
This commit is contained in:
parent
ac06b1cfcf
commit
2d3a7c87c2
3 changed files with 21 additions and 18 deletions
|
@ -59,7 +59,9 @@ impl ServoInternalsMethods<crate::DomTypeHolder> for ServoInternals {
|
|||
|
||||
impl RoutedPromiseListener<MemoryReportResult> for ServoInternals {
|
||||
fn handle_response(&self, response: MemoryReportResult, promise: &Rc<Promise>, can_gc: CanGc) {
|
||||
promise.resolve_native(&response.content, can_gc);
|
||||
let stringified = serde_json::to_string(&response.results)
|
||||
.unwrap_or_else(|_| "{ error: \"failed to create memory report\"}".to_owned());
|
||||
promise.resolve_native(&stringified, can_gc);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue