Bug 1172897 - Rename Tab Actor to BrowsingContextActor

As part of [Bug 1172987](https://bugzilla.mozilla.org/show_bug.cgi?id=1172897) we renamed TabActor, as the actor does not represent tabs (as in a browser tab), it instead represents a browsing context as defined by the the [HTML standard](https://html.spec.whatwg.org/multipage/browsers.html#windows). In a later PR I will mirror the structure we have on devtools to have a targets folder, which contains all target types. At the moment it looks like servo only represents workers and browsing contexts.
This commit is contained in:
codehag 2018-09-23 16:13:39 +02:00
parent 196bec2b87
commit 86b78629c3
3 changed files with 34 additions and 34 deletions

View file

@ -25,6 +25,7 @@ extern crate servo_channel;
extern crate time;
use actor::{Actor, ActorRegistry};
use actors::browsing_context::BrowsingContextActor;
use actors::console::ConsoleActor;
use actors::framerate::FramerateActor;
use actors::inspector::InspectorActor;
@ -32,7 +33,6 @@ use actors::network_event::{EventActor, NetworkEventActor, ResponseStartMsg};
use actors::performance::PerformanceActor;
use actors::profiler::ProfilerActor;
use actors::root::RootActor;
use actors::tab::TabActor;
use actors::thread::ThreadActor;
use actors::timeline::TimelineActor;
use actors::worker::WorkerActor;
@ -55,6 +55,7 @@ use time::precise_time_ns;
mod actor;
/// Corresponds to http://mxr.mozilla.org/mozilla-central/source/toolkit/devtools/server/actors/
mod actors {
pub mod browsing_context;
pub mod console;
pub mod framerate;
pub mod inspector;
@ -64,7 +65,6 @@ mod actors {
pub mod performance;
pub mod profiler;
pub mod root;
pub mod tab;
pub mod thread;
pub mod timeline;
pub mod worker;
@ -202,7 +202,7 @@ fn run_server(
// We need separate actor representations for each script global that exists;
// clients can theoretically connect to multiple globals simultaneously.
// TODO: move this into the root or tab modules?
// TODO: move this into the root or target modules?
fn handle_new_global(
actors: Arc<Mutex<ActorRegistry>>,
ids: (PipelineId, Option<WorkerId>),
@ -215,8 +215,8 @@ fn run_server(
let (pipeline, worker_id) = ids;
//TODO: move all this actor creation into a constructor method on TabActor
let (tab, console, inspector, timeline, profiler, performance, thread) = {
//TODO: move all this actor creation into a constructor method on BrowsingContextActor
let (target, console, inspector, timeline, profiler, performance, thread) = {
let console = ConsoleActor {
name: actors.new_name("console"),
script_chan: script_sender.clone(),
@ -240,8 +240,8 @@ fn run_server(
let thread = ThreadActor::new(actors.new_name("context"));
let DevtoolsPageInfo { title, url } = page_info;
let tab = TabActor {
name: actors.new_name("tab"),
let target = BrowsingContextActor {
name: actors.new_name("target"),
title: String::from(title),
url: url.into_string(),
console: console.name(),
@ -253,10 +253,10 @@ fn run_server(
};
let root = actors.find_mut::<RootActor>("root");
root.tabs.push(tab.name.clone());
root.tabs.push(target.name.clone());
(
tab,
target,
console,
inspector,
timeline,
@ -276,8 +276,8 @@ fn run_server(
actors.register(Box::new(worker));
}
actor_pipelines.insert(pipeline, tab.name.clone());
actors.register(Box::new(tab));
actor_pipelines.insert(pipeline, target.name.clone());
actors.register(Box::new(target));
actors.register(Box::new(console));
actors.register(Box::new(inspector));
actors.register(Box::new(timeline));
@ -342,7 +342,7 @@ fn run_server(
Some(actors.find::<WorkerActor>(actor_name).console.clone())
} else {
let actor_name = (*actor_pipelines).get(&id)?;
Some(actors.find::<TabActor>(actor_name).console.clone())
Some(actors.find::<BrowsingContextActor>(actor_name).console.clone())
}
}