DevTools: Add resource_available as a common shared util (#36632)

These PR adds `resource_available` as a common shared util


- [x] ./mach build -d does not report any errors
- [x] ./mach test-tidy does not report any errors
- [x] These changes partially implement
https://github.com/servo/servo/issues/36027

---------

Signed-off-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
atbrakhi 2025-04-23 14:36:59 +02:00 committed by GitHub
parent e9e103b46c
commit 7c1e5918a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 68 additions and 28 deletions

View file

@ -17,6 +17,7 @@ use servo_url::ServoUrl;
use crate::StreamId;
use crate::actor::{Actor, ActorMessageStatus, ActorRegistry};
use crate::protocol::JsonPacketStream;
use crate::resource::ResourceAvailable;
#[derive(Clone, Copy)]
#[allow(dead_code)]
@ -53,6 +54,16 @@ impl WorkerActor {
}
}
impl ResourceAvailable for WorkerActor {
fn actor_name(&self) -> String {
self.name.clone()
}
fn get_streams(&self) -> &RefCell<HashMap<StreamId, TcpStream>> {
&self.streams
}
}
impl Actor for WorkerActor {
fn name(&self) -> String {
self.name.clone()