mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
DevTools - add Emulation Actor
This commit is contained in:
parent
5327758b9b
commit
9ccf7c0a57
3 changed files with 47 additions and 1 deletions
|
@ -72,6 +72,7 @@ pub struct BrowsingContextActorMsg {
|
||||||
url: String,
|
url: String,
|
||||||
outerWindowID: u32,
|
outerWindowID: u32,
|
||||||
consoleActor: String,
|
consoleActor: String,
|
||||||
|
emulationActor: String,
|
||||||
inspectorActor: String,
|
inspectorActor: String,
|
||||||
timelineActor: String,
|
timelineActor: String,
|
||||||
profilerActor: String,
|
profilerActor: String,
|
||||||
|
@ -84,6 +85,7 @@ pub struct BrowsingContextActor {
|
||||||
pub title: String,
|
pub title: String,
|
||||||
pub url: String,
|
pub url: String,
|
||||||
pub console: String,
|
pub console: String,
|
||||||
|
pub emulation: String,
|
||||||
pub inspector: String,
|
pub inspector: String,
|
||||||
pub timeline: String,
|
pub timeline: String,
|
||||||
pub profiler: String,
|
pub profiler: String,
|
||||||
|
@ -192,6 +194,7 @@ impl BrowsingContextActor {
|
||||||
url: self.url.clone(),
|
url: self.url.clone(),
|
||||||
outerWindowID: 0, //FIXME: this should probably be the pipeline id
|
outerWindowID: 0, //FIXME: this should probably be the pipeline id
|
||||||
consoleActor: self.console.clone(),
|
consoleActor: self.console.clone(),
|
||||||
|
emulationActor: self.emulation.clone(),
|
||||||
inspectorActor: self.inspector.clone(),
|
inspectorActor: self.inspector.clone(),
|
||||||
timelineActor: self.timeline.clone(),
|
timelineActor: self.timeline.clone(),
|
||||||
profilerActor: self.profiler.clone(),
|
profilerActor: self.profiler.clone(),
|
||||||
|
|
35
components/devtools/actors/emulation.rs
Normal file
35
components/devtools/actors/emulation.rs
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
/* 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 EmulationActor {
|
||||||
|
pub name: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Actor for EmulationActor {
|
||||||
|
fn name(&self) -> String {
|
||||||
|
self.name.clone()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handle_message(
|
||||||
|
&self,
|
||||||
|
_registry: &ActorRegistry,
|
||||||
|
msg_type: &str,
|
||||||
|
_msg: &Map<String, Value>,
|
||||||
|
_stream: &mut TcpStream,
|
||||||
|
) -> Result<ActorMessageStatus, ()> {
|
||||||
|
Ok(match msg_type {
|
||||||
|
_ => ActorMessageStatus::Ignored,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl EmulationActor {
|
||||||
|
pub fn new(name: String) -> EmulationActor {
|
||||||
|
EmulationActor { name: name }
|
||||||
|
}
|
||||||
|
}
|
|
@ -28,6 +28,7 @@ use actor::{Actor, ActorRegistry};
|
||||||
use actors::browsing_context::BrowsingContextActor;
|
use actors::browsing_context::BrowsingContextActor;
|
||||||
use actors::console::ConsoleActor;
|
use actors::console::ConsoleActor;
|
||||||
use actors::device::DeviceActor;
|
use actors::device::DeviceActor;
|
||||||
|
use actors::emulation::EmulationActor;
|
||||||
use actors::framerate::FramerateActor;
|
use actors::framerate::FramerateActor;
|
||||||
use actors::inspector::InspectorActor;
|
use actors::inspector::InspectorActor;
|
||||||
use actors::network_event::{EventActor, NetworkEventActor, ResponseStartMsg};
|
use actors::network_event::{EventActor, NetworkEventActor, ResponseStartMsg};
|
||||||
|
@ -60,6 +61,7 @@ mod actors {
|
||||||
pub mod browsing_context;
|
pub mod browsing_context;
|
||||||
pub mod console;
|
pub mod console;
|
||||||
pub mod device;
|
pub mod device;
|
||||||
|
pub mod emulation;
|
||||||
pub mod framerate;
|
pub mod framerate;
|
||||||
pub mod inspector;
|
pub mod inspector;
|
||||||
pub mod memory;
|
pub mod memory;
|
||||||
|
@ -230,13 +232,16 @@ fn run_server(
|
||||||
let (pipeline, worker_id) = ids;
|
let (pipeline, worker_id) = ids;
|
||||||
|
|
||||||
//TODO: move all this actor creation into a constructor method on BrowsingContextActor
|
//TODO: move all this actor creation into a constructor method on BrowsingContextActor
|
||||||
let (target, console, inspector, timeline, profiler, performance, styleSheets, thread) = {
|
let (target, console, emulation, inspector, timeline, profiler, performance, styleSheets, thread) = {
|
||||||
let console = ConsoleActor {
|
let console = ConsoleActor {
|
||||||
name: actors.new_name("console"),
|
name: actors.new_name("console"),
|
||||||
script_chan: script_sender.clone(),
|
script_chan: script_sender.clone(),
|
||||||
pipeline: pipeline,
|
pipeline: pipeline,
|
||||||
streams: RefCell::new(Vec::new()),
|
streams: RefCell::new(Vec::new()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let emulation = EmulationActor::new(actors.new_name("emulation"));
|
||||||
|
|
||||||
let inspector = InspectorActor {
|
let inspector = InspectorActor {
|
||||||
name: actors.new_name("inspector"),
|
name: actors.new_name("inspector"),
|
||||||
walker: RefCell::new(None),
|
walker: RefCell::new(None),
|
||||||
|
@ -262,6 +267,7 @@ fn run_server(
|
||||||
title: String::from(title),
|
title: String::from(title),
|
||||||
url: url.into_string(),
|
url: url.into_string(),
|
||||||
console: console.name(),
|
console: console.name(),
|
||||||
|
emulation: emulation.name(),
|
||||||
inspector: inspector.name(),
|
inspector: inspector.name(),
|
||||||
timeline: timeline.name(),
|
timeline: timeline.name(),
|
||||||
profiler: profiler.name(),
|
profiler: profiler.name(),
|
||||||
|
@ -276,6 +282,7 @@ fn run_server(
|
||||||
(
|
(
|
||||||
target,
|
target,
|
||||||
console,
|
console,
|
||||||
|
emulation,
|
||||||
inspector,
|
inspector,
|
||||||
timeline,
|
timeline,
|
||||||
profiler,
|
profiler,
|
||||||
|
@ -298,6 +305,7 @@ fn run_server(
|
||||||
actor_pipelines.insert(pipeline, target.name.clone());
|
actor_pipelines.insert(pipeline, target.name.clone());
|
||||||
actors.register(Box::new(target));
|
actors.register(Box::new(target));
|
||||||
actors.register(Box::new(console));
|
actors.register(Box::new(console));
|
||||||
|
actors.register(Box::new(emulation));
|
||||||
actors.register(Box::new(inspector));
|
actors.register(Box::new(inspector));
|
||||||
actors.register(Box::new(timeline));
|
actors.register(Box::new(timeline));
|
||||||
actors.register(Box::new(profiler));
|
actors.register(Box::new(profiler));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue