diff options
author | atbrakhi <atbrakhi@igalia.com> | 2025-05-09 14:06:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-09 12:06:33 +0000 |
commit | 2aaf9695df177574b4a51ec1e49099a64035bb9d (patch) | |
tree | 63bf2c7472963c2a0db2ecef1982ee623835b0e3 /components/devtools/lib.rs | |
parent | e5347eceacd7354c8f48bddbf2d9cee6b8f8cfc3 (diff) | |
download | servo-2aaf9695df177574b4a51ec1e49099a64035bb9d.tar.gz servo-2aaf9695df177574b4a51ec1e49099a64035bb9d.zip |
DevTools: Improve `resource_available` to handle multiple connections (#36933)
This patch improves the `resource_available` trait to handle multiple
connections. In this patch we also remove the redundant
`resource_available` from worker actor
Testing: Existing tests in DevTools already tests for this. We do not
need to add new test
Fixes: part of #36027
Signed-off-by: atbrakhi <atbrakhi@igalia.com>
Co-authored-by: Delan Azabani <dazabani@igalia.com>
Diffstat (limited to 'components/devtools/lib.rs')
-rw-r--r-- | components/devtools/lib.rs | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/components/devtools/lib.rs b/components/devtools/lib.rs index 5fb9485e9d3..d097cb25e9d 100644 --- a/components/devtools/lib.rs +++ b/components/devtools/lib.rs @@ -414,7 +414,7 @@ impl DevtoolsInstance { } fn handle_page_error( - &self, + &mut self, pipeline_id: PipelineId, worker_id: Option<WorkerId>, page_error: PageError, @@ -426,11 +426,13 @@ impl DevtoolsInstance { let actors = self.actors.lock().unwrap(); let console_actor = actors.find::<ConsoleActor>(&console_actor_name); let id = worker_id.map_or(UniqueId::Pipeline(pipeline_id), UniqueId::Worker); - console_actor.handle_page_error(page_error, id, &actors); + for stream in self.connections.values_mut() { + console_actor.handle_page_error(page_error.clone(), id.clone(), &actors, stream); + } } fn handle_console_message( - &self, + &mut self, pipeline_id: PipelineId, worker_id: Option<WorkerId>, console_message: ConsoleMessage, @@ -442,7 +444,9 @@ impl DevtoolsInstance { let actors = self.actors.lock().unwrap(); let console_actor = actors.find::<ConsoleActor>(&console_actor_name); let id = worker_id.map_or(UniqueId::Pipeline(pipeline_id), UniqueId::Worker); - console_actor.handle_console_api(console_message, id, &actors); + for stream in self.connections.values_mut() { + console_actor.handle_console_api(console_message.clone(), id.clone(), &actors, stream); + } } fn find_console_actor( @@ -529,7 +533,10 @@ impl DevtoolsInstance { }; let worker_actor = actors.find::<WorkerActor>(worker_actor_name); - worker_actor.resource_available(source, "source".into()); + + for stream in self.connections.values_mut() { + worker_actor.resource_available(&source, "source".into(), stream); + } } else { let Some(browsing_context_id) = self.pipelines.get(&pipeline_id) else { return; @@ -556,7 +563,10 @@ impl DevtoolsInstance { // Notify browsing context about the new source let browsing_context = actors.find::<BrowsingContextActor>(actor_name); - browsing_context.resource_available(source, "source".into()); + + for stream in self.connections.values_mut() { + browsing_context.resource_available(&source, "source".into(), stream); + } } } } |