mirror of
https://github.com/servo/servo.git
synced 2025-07-07 07:23:38 +01:00
Add common resourceId to network events (#37707)
- Add a `resource_id` field to `EventActor` and `NetworkEventActor` - Store a `next_resource_id` field in DevtoolsInstance - Add `resource_id` parameter to `NetworkEventActor::new` - Increment `next_resource_id` when `DevtoolsInstance::find_network_event_actor` is called so each network event has a unique id Testing: Ran servo in devtools mode and can see the data showing in `status`,`type`, `transferred` ,`size` and `timeline` columns of each request, also logged the devtools instance and can see unique `resourceId` for each request. Fixes: https://github.com/servo/servo/issues/37661 Signed-off-by: Uthman Yahaya Baba <uthmanyahayababa@gmail.com>
This commit is contained in:
parent
f745bad37d
commit
253fb247f5
2 changed files with 11 additions and 3 deletions
|
@ -120,6 +120,7 @@ struct DevtoolsInstance {
|
|||
actor_workers: HashMap<WorkerId, String>,
|
||||
actor_requests: HashMap<String, String>,
|
||||
connections: HashMap<StreamId, TcpStream>,
|
||||
next_resource_id: u64,
|
||||
}
|
||||
|
||||
impl DevtoolsInstance {
|
||||
|
@ -182,6 +183,7 @@ impl DevtoolsInstance {
|
|||
actor_requests: HashMap::new(),
|
||||
actor_workers: HashMap::new(),
|
||||
connections: HashMap::new(),
|
||||
next_resource_id: 1,
|
||||
};
|
||||
|
||||
thread::Builder::new()
|
||||
|
@ -509,8 +511,10 @@ impl DevtoolsInstance {
|
|||
name.into_mut().clone()
|
||||
},
|
||||
Vacant(entry) => {
|
||||
let resource_id = self.next_resource_id;
|
||||
self.next_resource_id += 1;
|
||||
let actor_name = actors.new_name("netevent");
|
||||
let actor = NetworkEventActor::new(actor_name.clone());
|
||||
let actor = NetworkEventActor::new(actor_name.clone(), resource_id);
|
||||
entry.insert(actor_name.clone());
|
||||
actors.register(Box::new(actor));
|
||||
actor_name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue