mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
removed unused macros from main/macros.rs
This commit is contained in:
parent
c9c6cb3bf5
commit
6f7107ee9b
5 changed files with 35 additions and 96 deletions
|
@ -72,12 +72,14 @@ impl NavigationContext {
|
||||||
self.current.get()
|
self.current.get()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn navigate(&mut self, id: uint) {
|
/// Navigates to a new id, returning all id's evicted from next
|
||||||
self.next.clear();
|
pub fn navigate(&mut self, id: uint) -> ~[uint] {
|
||||||
|
let evicted = replace(&mut self.next, ~[]);
|
||||||
do self.current.mutate_default(id) |cur_id| {
|
do self.current.mutate_default(id) |cur_id| {
|
||||||
self.previous.push(cur_id);
|
self.previous.push(cur_id);
|
||||||
id
|
id
|
||||||
}
|
}
|
||||||
|
evicted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,25 +93,29 @@ impl Constellation {
|
||||||
|
|
||||||
let opts = Cell::new(copy *opts);
|
let opts = Cell::new(copy *opts);
|
||||||
|
|
||||||
let (constellation_port, constellation_chan) = comm::stream();
|
let (constellation_port, constellation_chan) = special_stream!(ConstellationChan);
|
||||||
let (constellation_port, constellation_chan) = (Cell::new(constellation_port),
|
let constellation_port = Cell::new(constellation_port);
|
||||||
ConstellationChan::new(constellation_chan));
|
|
||||||
|
|
||||||
let compositor_chan = Cell::new(compositor_chan);
|
let compositor_chan = Cell::new(compositor_chan);
|
||||||
let constellation_chan_clone = Cell::new(constellation_chan.clone());
|
let constellation_chan_clone = Cell::new(constellation_chan.clone());
|
||||||
|
|
||||||
|
let resource_task = Cell::new(resource_task);
|
||||||
|
let image_cache_task = Cell::new(image_cache_task);
|
||||||
|
let profiler_chan = Cell::new(profiler_chan);
|
||||||
|
|
||||||
do task::spawn {
|
do task::spawn {
|
||||||
let mut constellation = Constellation {
|
let mut constellation = Constellation {
|
||||||
chan: constellation_chan_clone.take(),
|
chan: constellation_chan_clone.take(),
|
||||||
request_port: constellation_port.take(),
|
request_port: constellation_port.take(),
|
||||||
compositor_chan: compositor_chan.take(),
|
compositor_chan: compositor_chan.take(),
|
||||||
resource_task: resource_task.clone(),
|
resource_task: resource_task.take(),
|
||||||
image_cache_task: image_cache_task.clone(),
|
image_cache_task: image_cache_task.take(),
|
||||||
pipelines: HashMap::new(),
|
pipelines: HashMap::new(),
|
||||||
navigation_context: NavigationContext::new(),
|
navigation_context: NavigationContext::new(),
|
||||||
next_id: 0,
|
next_id: 0,
|
||||||
current_token_bearer: None,
|
current_token_bearer: None,
|
||||||
next_token_bearer: None,
|
next_token_bearer: None,
|
||||||
profiler_chan: profiler_chan.clone(),
|
profiler_chan: profiler_chan.take(),
|
||||||
opts: opts.take(),
|
opts: opts.take(),
|
||||||
};
|
};
|
||||||
constellation.run();
|
constellation.run();
|
||||||
|
@ -234,7 +240,14 @@ impl Constellation {
|
||||||
self.next_token_bearer = None;
|
self.next_token_bearer = None;
|
||||||
// Don't navigate on Navigate type, because that is handled by forward/back
|
// Don't navigate on Navigate type, because that is handled by forward/back
|
||||||
match pipeline.navigation_type.get() {
|
match pipeline.navigation_type.get() {
|
||||||
constellation_msg::Load => self.navigation_context.navigate(id),
|
constellation_msg::Load => {
|
||||||
|
let evicted = self.navigation_context.navigate(id);
|
||||||
|
/* FIXME(tkuehn): the following code causes a segfault
|
||||||
|
for evicted.iter().advance |id| {
|
||||||
|
self.pipelines.get(id).exit();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,79 +2,11 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||||
#[macro_escape];
|
#[macro_escape];
|
||||||
{
|
macro_rules! special_stream(
|
||||||
macro_rules! move_ref(
|
($Chan:ident) => (
|
||||||
{ $x:expr } => { unsafe { let y <- *ptr::to_unsafe_ptr(*$x); y } }
|
|
||||||
)
|
|
||||||
|
|
||||||
macro_rules! move_val(
|
|
||||||
{ $x:expr } => { unsafe { let y <- *ptr::to_unsafe_ptr(*$x); y } }
|
|
||||||
)
|
|
||||||
|
|
||||||
// select!
|
|
||||||
macro_rules! select_if(
|
|
||||||
|
|
||||||
{
|
{
|
||||||
$index:expr,
|
let (port, chan) = comm::stream::();
|
||||||
$count:expr
|
(port, $Chan::new(chan))
|
||||||
} => {
|
|
||||||
fail
|
|
||||||
};
|
|
||||||
|
|
||||||
{
|
|
||||||
$index:expr,
|
|
||||||
$count:expr,
|
|
||||||
$port:path => [
|
|
||||||
$(type_this $message:path$(($(x $x: ident),+))dont_type_this*
|
|
||||||
-> $next:ident => { $e:expr }),+
|
|
||||||
]
|
|
||||||
$(, $ports:path => [
|
|
||||||
$(type_this $messages:path$(($(x $xs: ident),+))dont_type_this*
|
|
||||||
-> $nexts:ident => { $es:expr }),+
|
|
||||||
] )*
|
|
||||||
} => {
|
|
||||||
if $index == $count {
|
|
||||||
match pipes::try_recv($port) {
|
|
||||||
$(Some($message($($(ref $x,)+)* ref next)) => {
|
|
||||||
// FIXME (#2329) we really want move out of enum here.
|
|
||||||
let $next = move_ref!(next);
|
|
||||||
$e
|
|
||||||
})+
|
|
||||||
_ => fail
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
select_if!(
|
|
||||||
$index,
|
|
||||||
$count + 1
|
|
||||||
$(, $ports => [
|
|
||||||
$(type_this $messages$(($(x $xs),+))dont_type_this*
|
|
||||||
-> $nexts => { $es }),+
|
|
||||||
])*
|
|
||||||
)
|
|
||||||
}
|
|
||||||
};
|
|
||||||
)
|
|
||||||
|
|
||||||
macro_rules! select(
|
|
||||||
{
|
|
||||||
$( $port:path => {
|
|
||||||
$($message:path$(($($x: ident),+))dont_type_this*
|
|
||||||
-> $next:ident $e:expr),+
|
|
||||||
} )+
|
|
||||||
} => {
|
|
||||||
let index = pipes::selecti([$(($port).header()),+]/_);
|
|
||||||
select_if!(index, 0 $(, $port => [
|
|
||||||
$(type_this $message$(($(x $x),+))dont_type_this* -> $next => { $e }),+
|
|
||||||
])+)
|
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
|
)
|
||||||
macro_rules! closure_stream(
|
|
||||||
($Msg:ty, $Chan:ident) => (
|
|
||||||
{
|
|
||||||
let (port, chan) = comm::stream::<$Msg>();
|
|
||||||
(Cell(port), $Chan::new(chan))
|
|
||||||
}
|
|
||||||
);
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
|
@ -18,15 +18,6 @@ use servo_net::resource_task::ResourceTask;
|
||||||
use servo_util::time::ProfilerChan;
|
use servo_util::time::ProfilerChan;
|
||||||
use std::comm;
|
use std::comm;
|
||||||
|
|
||||||
macro_rules! special_stream(
|
|
||||||
($Chan:ident) => (
|
|
||||||
{
|
|
||||||
let (port, chan) = comm::stream::();
|
|
||||||
(port, $Chan::new(chan))
|
|
||||||
}
|
|
||||||
);
|
|
||||||
)
|
|
||||||
|
|
||||||
/// A uniquely-identifiable pipeline of stript task, layout task, and render task.
|
/// A uniquely-identifiable pipeline of stript task, layout task, and render task.
|
||||||
pub struct Pipeline {
|
pub struct Pipeline {
|
||||||
id: uint,
|
id: uint,
|
||||||
|
@ -64,16 +55,16 @@ impl Pipeline {
|
||||||
render_chan.clone(),
|
render_chan.clone(),
|
||||||
image_cache_task.clone(),
|
image_cache_task.clone(),
|
||||||
copy opts,
|
copy opts,
|
||||||
profiler_chan.clone());
|
profiler_chan);
|
||||||
|
|
||||||
ScriptTask::create(id,
|
ScriptTask::create(id,
|
||||||
compositor_chan.clone(),
|
compositor_chan,
|
||||||
layout_chan.clone(),
|
layout_chan.clone(),
|
||||||
script_port,
|
script_port,
|
||||||
script_chan.clone(),
|
script_chan.clone(),
|
||||||
constellation_chan,
|
constellation_chan,
|
||||||
resource_task.clone(),
|
resource_task,
|
||||||
image_cache_task.clone());
|
image_cache_task);
|
||||||
|
|
||||||
Pipeline::new(id,
|
Pipeline::new(id,
|
||||||
script_chan,
|
script_chan,
|
||||||
|
|
|
@ -53,6 +53,8 @@ use std::os;
|
||||||
#[path="compositing/mod.rs"]
|
#[path="compositing/mod.rs"]
|
||||||
pub mod compositing;
|
pub mod compositing;
|
||||||
|
|
||||||
|
pub mod macros;
|
||||||
|
|
||||||
pub mod css {
|
pub mod css {
|
||||||
priv mod select_handler;
|
priv mod select_handler;
|
||||||
priv mod node_util;
|
priv mod node_util;
|
||||||
|
|
|
@ -70,6 +70,7 @@ pub struct CompositorToken {
|
||||||
impl CompositorToken {
|
impl CompositorToken {
|
||||||
pub fn new() -> CompositorToken {
|
pub fn new() -> CompositorToken {
|
||||||
CompositorToken {
|
CompositorToken {
|
||||||
|
// Of course, this doesn't guarantee that renderers will invalidate their tokens
|
||||||
construction_restrictor: NonCopyable::new(),
|
construction_restrictor: NonCopyable::new(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue