Skip to content

Commit

Permalink
DevTools - add preliminary StyleSheetActor
Browse files Browse the repository at this point in the history
  • Loading branch information
codehag committed Oct 14, 2018
1 parent e4657c1 commit c88cc3e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
3 changes: 3 additions & 0 deletions components/devtools/actors/browsing_context.rs
Expand Up @@ -65,6 +65,7 @@ pub struct BrowsingContextActorMsg {
timelineActor: String,
profilerActor: String,
performanceActor: String,
styleSheetsActor: String,
}

pub struct BrowsingContextActor {
Expand All @@ -76,6 +77,7 @@ pub struct BrowsingContextActor {
pub timeline: String,
pub profiler: String,
pub performance: String,
pub styleSheets: String,
pub thread: String,
}

Expand Down Expand Up @@ -174,6 +176,7 @@ impl BrowsingContextActor {
timelineActor: self.timeline.clone(),
profilerActor: self.profiler.clone(),
performanceActor: self.performance.clone(),
styleSheetsActor: self.styleSheets.clone(),
}
}
}
33 changes: 33 additions & 0 deletions components/devtools/actors/stylesheets.rs
@@ -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 }
}
}

10 changes: 9 additions & 1 deletion components/devtools/lib.rs
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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(),
Expand All @@ -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;
Expand All @@ -249,6 +254,7 @@ fn run_server(
timeline: timeline.name(),
profiler: profiler.name(),
performance: performance.name(),
styleSheets: styleSheets.name(),
thread: thread.name(),
};

Expand All @@ -262,6 +268,7 @@ fn run_server(
timeline,
profiler,
performance,
styleSheets,
thread,
)
};
Expand All @@ -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));
}

Expand Down

0 comments on commit c88cc3e

Please sign in to comment.