auto merge of #4609 : Ms2ger/servo/runnable-self-by-value, r=jdm

This commit is contained in:
bors-servo 2015-01-10 10:30:44 -07:00
commit 879af966b3
4 changed files with 10 additions and 10 deletions

View file

@ -15,11 +15,9 @@ use js::jsval::{JSVal, UndefinedValue};
use libc::size_t; use libc::size_t;
use std::ptr; use std::ptr;
#[allow(raw_pointer_deriving)]
#[deriving(Copy)]
pub struct StructuredCloneData { pub struct StructuredCloneData {
pub data: *mut u64, data: *mut u64,
pub nbytes: size_t, nbytes: size_t,
} }
impl StructuredCloneData { impl StructuredCloneData {

View file

@ -115,7 +115,8 @@ impl WorkerMessageHandler {
} }
impl Runnable for WorkerMessageHandler { impl Runnable for WorkerMessageHandler {
fn handler(&self){ fn handler(self: Box<WorkerMessageHandler>) {
Worker::handle_message(self.addr.clone(), self.data); let this = *self;
Worker::handle_message(this.addr, this.data);
} }
} }

View file

@ -85,8 +85,9 @@ impl XHRProgressHandler {
} }
impl Runnable for XHRProgressHandler { impl Runnable for XHRProgressHandler {
fn handler(&self) { fn handler(self: Box<XHRProgressHandler>) {
XMLHttpRequest::handle_progress(self.addr.clone(), self.progress.clone()); let this = *self;
XMLHttpRequest::handle_progress(this.addr, this.progress);
} }
} }

View file

@ -96,7 +96,7 @@ pub enum TimerSource {
} }
pub trait Runnable { pub trait Runnable {
fn handler(&self); fn handler(self: Box<Self>);
} }
/// Messages used to control script event loops, such as ScriptTask and /// Messages used to control script event loops, such as ScriptTask and
@ -1385,7 +1385,7 @@ impl DocumentProgressHandler {
} }
impl Runnable for DocumentProgressHandler { impl Runnable for DocumentProgressHandler {
fn handler(&self) { fn handler(self: Box<DocumentProgressHandler>) {
match self.task { match self.task {
DocumentProgressTask::DOMContentLoaded => { DocumentProgressTask::DOMContentLoaded => {
self.dispatch_dom_content_loaded(); self.dispatch_dom_content_loaded();