mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Devtools: refactor source actor state (#37528)
We currently store the source contents in both the SourceActor and the ThreadActor’s SourceManager, which is redundant. We also currently send the source contents in thread `sources` responses and watcher `resources-available-array` messages, but in both cases this is unnecessary (and ignored by the client). This patch merges SourceData into SourceActor, making the latter the single source of truth for source-related state. We also create a SourceForm type, which represents the subset of source-related state that gets sent in thread `sources` responses (and for now, watcher `resources-available-array` messages). Finally we rename `source_urls` → `source_actor_names` and `new_source` → `new_registered` for clarity. Testing: no changes to client-facing behaviour, and this is covered by tests Signed-off-by: Delan Azabani <dazabani@igalia.com> Co-authored-by: atbrakhi <atbrakhi@igalia.com>
This commit is contained in:
parent
97011a53ac
commit
0896341285
4 changed files with 62 additions and 61 deletions
|
@ -297,9 +297,8 @@ impl Actor for WatcherActor {
|
|||
},
|
||||
"source" => {
|
||||
let thread_actor = registry.find::<ThreadActor>(&target.thread);
|
||||
let sources = thread_actor.source_manager.sources();
|
||||
target.resources_available(
|
||||
sources.iter().collect(),
|
||||
thread_actor.source_manager.source_forms(registry),
|
||||
"source".into(),
|
||||
stream,
|
||||
);
|
||||
|
@ -307,10 +306,9 @@ impl Actor for WatcherActor {
|
|||
for worker_name in &root.workers {
|
||||
let worker = registry.find::<WorkerActor>(worker_name);
|
||||
let thread = registry.find::<ThreadActor>(&worker.thread);
|
||||
let worker_sources = thread.source_manager.sources();
|
||||
|
||||
worker.resources_available(
|
||||
worker_sources.iter().collect(),
|
||||
thread.source_manager.source_forms(registry),
|
||||
"source".into(),
|
||||
stream,
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue