mirror of
https://github.com/servo/servo.git
synced 2025-07-22 06:43:40 +01:00
DevTools - add preliminary StyleSheetActor
This commit is contained in:
parent
e4657c1496
commit
c88cc3e966
3 changed files with 45 additions and 1 deletions
|
@ -65,6 +65,7 @@ pub struct BrowsingContextActorMsg {
|
|||
timelineActor: String,
|
||||
profilerActor: String,
|
||||
performanceActor: String,
|
||||
styleSheetsActor: String,
|
||||
}
|
||||
|
||||
pub struct BrowsingContextActor {
|
||||
|
@ -76,6 +77,7 @@ pub struct BrowsingContextActor {
|
|||
pub timeline: String,
|
||||
pub profiler: String,
|
||||
pub performance: String,
|
||||
pub styleSheets: String,
|
||||
pub thread: String,
|
||||
}
|
||||
|
||||
|
@ -174,6 +176,7 @@ impl BrowsingContextActor {
|
|||
timelineActor: self.timeline.clone(),
|
||||
profilerActor: self.profiler.clone(),
|
||||
performanceActor: self.performance.clone(),
|
||||
styleSheetsActor: self.styleSheets.clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
33
components/devtools/actors/stylesheets.rs
Normal file
33
components/devtools/actors/stylesheets.rs
Normal file
|
@ -0,0 +1,33 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
use actor::{Actor, ActorMessageStatus, ActorRegistry};
|
||||
use serde_json::{Map, Value};
|
||||
use std::net::TcpStream;
|
||||
|
||||
pub struct StyleSheetsActor {
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
impl Actor for StyleSheetsActor {
|
||||
fn name(&self) -> String {
|
||||
self.name.clone()
|
||||
}
|
||||
fn handle_message(
|
||||
&self,
|
||||
_: &ActorRegistry,
|
||||
_: &str,
|
||||
_: &Map<String, Value>,
|
||||
_: &mut TcpStream,
|
||||
) -> Result<ActorMessageStatus, ()> {
|
||||
Ok(ActorMessageStatus::Ignored)
|
||||
}
|
||||
}
|
||||
|
||||
impl StyleSheetsActor {
|
||||
pub fn new(name: String) -> StyleSheetsActor {
|
||||
StyleSheetsActor { name: name }
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +33,7 @@ use actors::network_event::{EventActor, NetworkEventActor, ResponseStartMsg};
|
|||
use actors::performance::PerformanceActor;
|
||||
use actors::profiler::ProfilerActor;
|
||||
use actors::root::RootActor;
|
||||
use actors::stylesheets::StyleSheetsActor;
|
||||
use actors::thread::ThreadActor;
|
||||
use actors::timeline::TimelineActor;
|
||||
use actors::worker::WorkerActor;
|
||||
|
@ -65,6 +66,7 @@ mod actors {
|
|||
pub mod performance;
|
||||
pub mod profiler;
|
||||
pub mod root;
|
||||
pub mod stylesheets;
|
||||
pub mod thread;
|
||||
pub mod timeline;
|
||||
pub mod worker;
|
||||
|
@ -216,7 +218,7 @@ fn run_server(
|
|||
let (pipeline, worker_id) = ids;
|
||||
|
||||
//TODO: move all this actor creation into a constructor method on BrowsingContextActor
|
||||
let (target, console, inspector, timeline, profiler, performance, thread) = {
|
||||
let (target, console, inspector, timeline, profiler, performance, styleSheets, thread) = {
|
||||
let console = ConsoleActor {
|
||||
name: actors.new_name("console"),
|
||||
script_chan: script_sender.clone(),
|
||||
|
@ -237,6 +239,9 @@ fn run_server(
|
|||
let profiler = ProfilerActor::new(actors.new_name("profiler"));
|
||||
let performance = PerformanceActor::new(actors.new_name("performance"));
|
||||
|
||||
// the strange switch between styleSheets and stylesheets is due
|
||||
// to an inconsistency in devtools. See Bug #1498893 in bugzilla
|
||||
let styleSheets = StyleSheetsActor::new(actors.new_name("stylesheets"));
|
||||
let thread = ThreadActor::new(actors.new_name("context"));
|
||||
|
||||
let DevtoolsPageInfo { title, url } = page_info;
|
||||
|
@ -249,6 +254,7 @@ fn run_server(
|
|||
timeline: timeline.name(),
|
||||
profiler: profiler.name(),
|
||||
performance: performance.name(),
|
||||
styleSheets: styleSheets.name(),
|
||||
thread: thread.name(),
|
||||
};
|
||||
|
||||
|
@ -262,6 +268,7 @@ fn run_server(
|
|||
timeline,
|
||||
profiler,
|
||||
performance,
|
||||
styleSheets,
|
||||
thread,
|
||||
)
|
||||
};
|
||||
|
@ -283,6 +290,7 @@ fn run_server(
|
|||
actors.register(Box::new(timeline));
|
||||
actors.register(Box::new(profiler));
|
||||
actors.register(Box::new(performance));
|
||||
actors.register(Box::new(styleSheets));
|
||||
actors.register(Box::new(thread));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue