Rename Task to TaskBox

This commit is contained in:
Anthony Ramine 2017-09-20 09:59:52 +02:00
parent f088b708c9
commit 52527d6f9d
19 changed files with 71 additions and 69 deletions

View file

@ -40,7 +40,7 @@ use std::marker::PhantomData;
use std::os; use std::os;
use std::rc::Rc; use std::rc::Rc;
use std::sync::{Arc, Weak}; use std::sync::{Arc, Weak};
use task::Task; use task::TaskBox;
#[allow(missing_docs)] // FIXME #[allow(missing_docs)] // FIXME
@ -122,7 +122,7 @@ impl TrustedPromise {
/// A task which will reject the promise. /// A task which will reject the promise.
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
pub fn reject_task(self, error: Error) -> impl Task { pub fn reject_task(self, error: Error) -> impl TaskBox {
let this = self; let this = self;
task!(reject_promise: move || { task!(reject_promise: move || {
debug!("Rejecting promise."); debug!("Rejecting promise.");
@ -135,7 +135,7 @@ impl TrustedPromise {
/// A task which will resolve the promise. /// A task which will resolve the promise.
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
pub fn resolve_task<T>(self, value: T) -> impl Task pub fn resolve_task<T>(self, value: T) -> impl TaskBox
where where
T: ToJSValConvertible + Send, T: ToJSValConvertible + Send,
{ {

View file

@ -40,7 +40,7 @@ use std::collections::HashMap;
use std::rc::Rc; use std::rc::Rc;
use std::str::FromStr; use std::str::FromStr;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use task::Task; use task::TaskBox;
const KEY_CONVERSION_ERROR: &'static str = "This `manufacturerData` key can not be parsed as unsigned short:"; const KEY_CONVERSION_ERROR: &'static str = "This `manufacturerData` key can not be parsed as unsigned short:";
const FILTER_EMPTY_ERROR: &'static str = "'filters' member, if present, must be nonempty to find any devices."; const FILTER_EMPTY_ERROR: &'static str = "'filters' member, if present, must be nonempty to find any devices.";
@ -229,11 +229,11 @@ pub fn response_async<T: AsyncBluetoothListener + DomObject + 'static>(
action: BluetoothResponseResult, action: BluetoothResponseResult,
} }
impl<T> Task for ListenerTask<T> impl<T> TaskBox for ListenerTask<T>
where where
T: AsyncBluetoothListener + DomObject, T: AsyncBluetoothListener + DomObject,
{ {
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let this = *self; let this = *self;
let mut context = this.context.lock().unwrap(); let mut context = this.context.lock().unwrap();
context.response(this.action); context.response(this.action);

View file

@ -119,7 +119,7 @@ use style::thread_state;
use style::values::{CSSFloat, Either}; use style::values::{CSSFloat, Either};
use style::values::{specified, computed}; use style::values::{specified, computed};
use stylesheet_loader::StylesheetOwner; use stylesheet_loader::StylesheetOwner;
use task::Task; use task::TaskBox;
// TODO: Update focus state when the top-level browsing context gains or loses system focus, // TODO: Update focus state when the top-level browsing context gains or loses system focus,
// and when the element enters or leaves a browsing context container. // and when the element enters or leaves a browsing context container.
@ -3047,9 +3047,9 @@ impl ElementPerformFullscreenEnter {
} }
} }
impl Task for ElementPerformFullscreenEnter { impl TaskBox for ElementPerformFullscreenEnter {
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let element = self.element.root(); let element = self.element.root();
let document = document_from_node(element.r()); let document = document_from_node(element.r());
@ -3100,9 +3100,9 @@ impl ElementPerformFullscreenExit {
} }
} }
impl Task for ElementPerformFullscreenExit { impl TaskBox for ElementPerformFullscreenExit {
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let element = self.element.root(); let element = self.element.root();
let document = document_from_node(element.r()); let document = document_from_node(element.r());
// TODO Step 9.1-5 // TODO Step 9.1-5

View file

@ -23,7 +23,7 @@ use dom_struct::dom_struct;
use servo_atoms::Atom; use servo_atoms::Atom;
use std::cell::Cell; use std::cell::Cell;
use std::default::Default; use std::default::Default;
use task::Task; use task::TaskBox;
use time; use time;
#[dom_struct] #[dom_struct]
@ -388,8 +388,8 @@ pub struct EventTask {
pub cancelable: EventCancelable, pub cancelable: EventCancelable,
} }
impl Task for EventTask { impl TaskBox for EventTask {
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let target = self.target.root(); let target = self.target.root();
let bubbles = self.bubbles; let bubbles = self.bubbles;
let cancelable = self.cancelable; let cancelable = self.cancelable;
@ -403,8 +403,8 @@ pub struct SimpleEventTask {
pub name: Atom, pub name: Atom,
} }
impl Task for SimpleEventTask { impl TaskBox for SimpleEventTask {
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let target = self.target.root(); let target = self.target.root();
target.fire_event(self.name); target.fire_event(self.name);
} }

View file

@ -19,7 +19,7 @@ use js::jsapi::{HandleValue, JSContext};
use script_traits::{ScriptMsg, DOMMessage}; use script_traits::{ScriptMsg, DOMMessage};
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::cell::Cell; use std::cell::Cell;
use task::Task; use task::TaskBox;
pub type TrustedServiceWorkerAddress = Trusted<ServiceWorker>; pub type TrustedServiceWorkerAddress = Trusted<ServiceWorker>;
@ -104,9 +104,9 @@ impl ServiceWorkerMethods for ServiceWorker {
event_handler!(statechange, GetOnstatechange, SetOnstatechange); event_handler!(statechange, GetOnstatechange, SetOnstatechange);
} }
impl Task for SimpleWorkerErrorHandler<ServiceWorker> { impl TaskBox for SimpleWorkerErrorHandler<ServiceWorker> {
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let this = *self; let this = *self;
ServiceWorker::dispatch_simple_error(this.addr); ServiceWorker::dispatch_simple_error(this.addr);
} }

View file

@ -37,7 +37,7 @@ use std::borrow::ToOwned;
use std::cell::Cell; use std::cell::Cell;
use std::ptr; use std::ptr;
use std::thread; use std::thread;
use task::{Task, TaskCanceller}; use task::{TaskBox, TaskCanceller};
use task_source::TaskSource; use task_source::TaskSource;
use task_source::networking::NetworkingTaskSource; use task_source::networking::NetworkingTaskSource;
@ -397,9 +397,9 @@ struct ConnectionEstablishedTask {
protocol_in_use: Option<String>, protocol_in_use: Option<String>,
} }
impl Task for ConnectionEstablishedTask { impl TaskBox for ConnectionEstablishedTask {
/// https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established /// https://html.spec.whatwg.org/multipage/#feedback-from-the-protocol:concept-websocket-established
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let ws = self.address.root(); let ws = self.address.root();
// Step 1. // Step 1.
@ -422,13 +422,13 @@ struct BufferedAmountTask {
address: Trusted<WebSocket>, address: Trusted<WebSocket>,
} }
impl Task for BufferedAmountTask { impl TaskBox for BufferedAmountTask {
// See https://html.spec.whatwg.org/multipage/#dom-websocket-bufferedamount // See https://html.spec.whatwg.org/multipage/#dom-websocket-bufferedamount
// //
// To be compliant with standards, we need to reset bufferedAmount only when the event loop // To be compliant with standards, we need to reset bufferedAmount only when the event loop
// reaches step 1. In our implementation, the bytes will already have been sent on a background // reaches step 1. In our implementation, the bytes will already have been sent on a background
// thread. // thread.
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let ws = self.address.root(); let ws = self.address.root();
ws.buffered_amount.set(0); ws.buffered_amount.set(0);
@ -443,8 +443,8 @@ struct CloseTask {
reason: Option<String>, reason: Option<String>,
} }
impl Task for CloseTask { impl TaskBox for CloseTask {
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let ws = self.address.root(); let ws = self.address.root();
if ws.ready_state.get() == WebSocketRequestState::Closed { if ws.ready_state.get() == WebSocketRequestState::Closed {
@ -483,9 +483,9 @@ struct MessageReceivedTask {
message: MessageData, message: MessageData,
} }
impl Task for MessageReceivedTask { impl TaskBox for MessageReceivedTask {
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let ws = self.address.root(); let ws = self.address.root();
debug!("MessageReceivedTask::handler({:p}): readyState={:?}", &*ws, debug!("MessageReceivedTask::handler({:p}): readyState={:?}", &*ws,
ws.ready_state.get()); ws.ready_state.get());

View file

@ -28,7 +28,7 @@ use std::cell::Cell;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::{Sender, channel}; use std::sync::mpsc::{Sender, channel};
use task::Task; use task::TaskBox;
pub type TrustedWorkerAddress = Trusted<Worker>; pub type TrustedWorkerAddress = Trusted<Worker>;
@ -175,9 +175,9 @@ impl WorkerMethods for Worker {
event_handler!(error, GetOnerror, SetOnerror); event_handler!(error, GetOnerror, SetOnerror);
} }
impl Task for SimpleWorkerErrorHandler<Worker> { impl TaskBox for SimpleWorkerErrorHandler<Worker> {
#[allow(unrooted_must_root)] #[allow(unrooted_must_root)]
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let this = *self; let this = *self;
Worker::dispatch_simple_error(this.addr); Worker::dispatch_simple_error(this.addr);
} }

View file

@ -388,7 +388,7 @@ impl WorkerGlobalScope {
pub fn process_event(&self, msg: CommonScriptMsg) { pub fn process_event(&self, msg: CommonScriptMsg) {
match msg { match msg {
CommonScriptMsg::Task(_, task) => { CommonScriptMsg::Task(_, task) => {
task.run() task.run_box()
}, },
CommonScriptMsg::CollectReports(reports_chan) => { CommonScriptMsg::CollectReports(reports_chan) => {
let cx = self.get_cx(); let cx = self.get_cx();

View file

@ -69,7 +69,7 @@ use std::thread;
use style::thread_state; use style::thread_state;
use swapper::Swapper; use swapper::Swapper;
use swapper::swapper; use swapper::swapper;
use task::Task; use task::TaskBox;
use uuid::Uuid; use uuid::Uuid;
// Magic numbers // Magic numbers
@ -647,7 +647,7 @@ impl WorkletThread {
/// Run a task in the main script thread. /// Run a task in the main script thread.
fn run_in_script_thread<T>(&self, task: T) fn run_in_script_thread<T>(&self, task: T)
where where
T: Task + 'static, T: TaskBox + 'static,
{ {
let msg = CommonScriptMsg::Task(ScriptThreadEventCategory::WorkletEvent, box task); let msg = CommonScriptMsg::Task(ScriptThreadEventCategory::WorkletEvent, box task);
let msg = MainThreadScriptMsg::Common(msg); let msg = MainThreadScriptMsg::Common(msg);

View file

@ -4,7 +4,7 @@
use net_traits::{Action, FetchResponseListener, FetchResponseMsg}; use net_traits::{Action, FetchResponseListener, FetchResponseMsg};
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
use task::{Task, TaskCanceller}; use task::{TaskBox, TaskCanceller};
use task_source::TaskSource; use task_source::TaskSource;
use task_source::networking::NetworkingTaskSource; use task_source::networking::NetworkingTaskSource;
@ -55,12 +55,12 @@ struct ListenerTask<A: Action<Listener> + Send + 'static, Listener: PreInvoke +
action: A, action: A,
} }
impl<A, Listener> Task for ListenerTask<A, Listener> impl<A, Listener> TaskBox for ListenerTask<A, Listener>
where where
A: Action<Listener> + Send + 'static, A: Action<Listener> + Send + 'static,
Listener: PreInvoke + Send, Listener: PreInvoke + Send,
{ {
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
let this = *self; let this = *self;
let mut context = this.context.lock().unwrap(); let mut context = this.context.lock().unwrap();
if context.should_invoke() { if context.should_invoke() {

View file

@ -35,7 +35,7 @@ use std::os::raw::c_void;
use std::panic::AssertUnwindSafe; use std::panic::AssertUnwindSafe;
use std::ptr; use std::ptr;
use style::thread_state; use style::thread_state;
use task::Task; use task::TaskBox;
use time::{Tm, now}; use time::{Tm, now};
/// Common messages used to control the event loops in both the script and the worker /// Common messages used to control the event loops in both the script and the worker
@ -44,7 +44,7 @@ pub enum CommonScriptMsg {
/// supplied channel. /// supplied channel.
CollectReports(ReportsChan), CollectReports(ReportsChan),
/// Generic message that encapsulates event handling. /// Generic message that encapsulates event handling.
Task(ScriptThreadEventCategory, Box<Task>), Task(ScriptThreadEventCategory, Box<TaskBox>),
} }
impl fmt::Debug for CommonScriptMsg { impl fmt::Debug for CommonScriptMsg {

View file

@ -1258,7 +1258,7 @@ impl ScriptThread {
self.handle_exit_window_msg(id) self.handle_exit_window_msg(id)
}, },
MainThreadScriptMsg::Common(CommonScriptMsg::Task(_, task)) => { MainThreadScriptMsg::Common(CommonScriptMsg::Task(_, task)) => {
task.run() task.run_box()
} }
MainThreadScriptMsg::Common(CommonScriptMsg::CollectReports(chan)) => { MainThreadScriptMsg::Common(CommonScriptMsg::CollectReports(chan)) => {
self.collect_reports(chan) self.collect_reports(chan)

View file

@ -13,7 +13,7 @@ macro_rules! task {
($name:ident: move || $body:tt) => {{ ($name:ident: move || $body:tt) => {{
#[allow(non_camel_case_types)] #[allow(non_camel_case_types)]
struct $name<F>(F); struct $name<F>(F);
impl<F> ::task::Task for $name<F> impl<F> ::task::TaskBox for $name<F>
where where
F: ::std::ops::FnOnce() + Send, F: ::std::ops::FnOnce() + Send,
{ {
@ -21,7 +21,7 @@ macro_rules! task {
stringify!($name) stringify!($name)
} }
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
(self.0)(); (self.0)();
} }
} }
@ -30,13 +30,15 @@ macro_rules! task {
} }
/// A task that can be run. The name method is for profiling purposes. /// A task that can be run. The name method is for profiling purposes.
pub trait Task: Send { ///
/// All tasks must be boxed to be run.
pub trait TaskBox: Send {
#[allow(unsafe_code)] #[allow(unsafe_code)]
fn name(&self) -> &'static str { unsafe { intrinsics::type_name::<Self>() } } fn name(&self) -> &'static str { unsafe { intrinsics::type_name::<Self>() } }
fn run(self: Box<Self>); fn run_box(self: Box<Self>);
} }
impl fmt::Debug for Task { impl fmt::Debug for TaskBox {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
fmt.debug_tuple(self.name()).field(&format_args!("...")).finish() fmt.debug_tuple(self.name()).field(&format_args!("...")).finish()
} }
@ -50,9 +52,9 @@ pub struct TaskCanceller {
impl TaskCanceller { impl TaskCanceller {
/// Returns a wrapped `task` that will be cancelled if the `TaskCanceller` /// Returns a wrapped `task` that will be cancelled if the `TaskCanceller`
/// says so. /// says so.
pub fn wrap_task<T>(&self, task: Box<T>) -> Box<Task> pub fn wrap_task<T>(&self, task: Box<T>) -> Box<TaskBox>
where where
T: Task + 'static, T: TaskBox + 'static,
{ {
box CancellableTask { box CancellableTask {
cancelled: self.cancelled.clone(), cancelled: self.cancelled.clone(),
@ -62,14 +64,14 @@ impl TaskCanceller {
} }
/// A task that can be cancelled by toggling a shared flag. /// A task that can be cancelled by toggling a shared flag.
pub struct CancellableTask<T: Task> { pub struct CancellableTask<T: TaskBox> {
cancelled: Option<Arc<AtomicBool>>, cancelled: Option<Arc<AtomicBool>>,
inner: Box<T>, inner: Box<T>,
} }
impl<T> CancellableTask<T> impl<T> CancellableTask<T>
where where
T: Task, T: TaskBox,
{ {
fn is_cancelled(&self) -> bool { fn is_cancelled(&self) -> bool {
self.cancelled.as_ref().map_or(false, |cancelled| { self.cancelled.as_ref().map_or(false, |cancelled| {
@ -78,17 +80,17 @@ where
} }
} }
impl<T> Task for CancellableTask<T> impl<T> TaskBox for CancellableTask<T>
where where
T: Task, T: TaskBox,
{ {
fn name(&self) -> &'static str { fn name(&self) -> &'static str {
self.inner.name() self.inner.name()
} }
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
if !self.is_cancelled() { if !self.is_cancelled() {
self.inner.run() self.inner.run_box()
} }
} }
} }

View file

@ -13,7 +13,7 @@ use servo_atoms::Atom;
use std::fmt; use std::fmt;
use std::result::Result; use std::result::Result;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use task::{Task, TaskCanceller}; use task::{TaskBox, TaskCanceller};
use task_source::TaskSource; use task_source::TaskSource;
#[derive(Clone, JSTraceable)] #[derive(Clone, JSTraceable)]
@ -32,7 +32,7 @@ impl TaskSource for DOMManipulationTaskSource {
canceller: &TaskCanceller, canceller: &TaskCanceller,
) -> Result<(), ()> ) -> Result<(), ()>
where where
T: Task + 'static, T: TaskBox + 'static,
{ {
let msg = MainThreadScriptMsg::Common(CommonScriptMsg::Task( let msg = MainThreadScriptMsg::Common(CommonScriptMsg::Task(
ScriptThreadEventCategory::ScriptEvent, ScriptThreadEventCategory::ScriptEvent,

View file

@ -6,7 +6,7 @@ use dom::domexception::DOMErrorName;
use dom::filereader::{FileReader, TrustedFileReader, GenerationId, ReadMetaData}; use dom::filereader::{FileReader, TrustedFileReader, GenerationId, ReadMetaData};
use script_runtime::{CommonScriptMsg, ScriptThreadEventCategory, ScriptChan}; use script_runtime::{CommonScriptMsg, ScriptThreadEventCategory, ScriptChan};
use std::sync::Arc; use std::sync::Arc;
use task::{Task, TaskCanceller}; use task::{TaskBox, TaskCanceller};
use task_source::TaskSource; use task_source::TaskSource;
#[derive(JSTraceable)] #[derive(JSTraceable)]
@ -25,7 +25,7 @@ impl TaskSource for FileReadingTaskSource {
canceller: &TaskCanceller, canceller: &TaskCanceller,
) -> Result<(), ()> ) -> Result<(), ()>
where where
T: Task + 'static, T: TaskBox + 'static,
{ {
self.0.send(CommonScriptMsg::Task( self.0.send(CommonScriptMsg::Task(
ScriptThreadEventCategory::FileRead, ScriptThreadEventCategory::FileRead,
@ -34,8 +34,8 @@ impl TaskSource for FileReadingTaskSource {
} }
} }
impl Task for FileReadingTask { impl TaskBox for FileReadingTask {
fn run(self: Box<Self>) { fn run_box(self: Box<Self>) {
self.handle_task(); self.handle_task();
} }
} }

View file

@ -11,7 +11,7 @@ pub mod user_interaction;
use dom::globalscope::GlobalScope; use dom::globalscope::GlobalScope;
use std::result::Result; use std::result::Result;
use task::{Task, TaskCanceller}; use task::{TaskBox, TaskCanceller};
pub trait TaskSource { pub trait TaskSource {
fn queue_with_canceller<T>( fn queue_with_canceller<T>(
@ -20,11 +20,11 @@ pub trait TaskSource {
canceller: &TaskCanceller, canceller: &TaskCanceller,
) -> Result<(), ()> ) -> Result<(), ()>
where where
T: Task + 'static; T: TaskBox + 'static;
fn queue<T>(&self, msg: Box<T>, global: &GlobalScope) -> Result<(), ()> fn queue<T>(&self, msg: Box<T>, global: &GlobalScope) -> Result<(), ()>
where where
T: Task + 'static, T: TaskBox + 'static,
{ {
self.queue_with_canceller(msg, &global.task_canceller()) self.queue_with_canceller(msg, &global.task_canceller())
} }

View file

@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use task::{Task, TaskCanceller}; use task::{TaskBox, TaskCanceller};
use task_source::TaskSource; use task_source::TaskSource;
#[derive(JSTraceable)] #[derive(JSTraceable)]
@ -22,7 +22,7 @@ impl TaskSource for NetworkingTaskSource {
canceller: &TaskCanceller, canceller: &TaskCanceller,
) -> Result<(), ()> ) -> Result<(), ()>
where where
T: Task + 'static, T: TaskBox + 'static,
{ {
self.0.send(CommonScriptMsg::Task( self.0.send(CommonScriptMsg::Task(
ScriptThreadEventCategory::NetworkEvent, ScriptThreadEventCategory::NetworkEvent,
@ -36,7 +36,7 @@ impl NetworkingTaskSource {
/// global scope gets destroyed. /// global scope gets destroyed.
pub fn queue_unconditionally<T>(&self, msg: Box<T>) -> Result<(), ()> pub fn queue_unconditionally<T>(&self, msg: Box<T>) -> Result<(), ()>
where where
T: Task + 'static, T: TaskBox + 'static,
{ {
self.0.send(CommonScriptMsg::Task(ScriptThreadEventCategory::NetworkEvent, msg)) self.0.send(CommonScriptMsg::Task(ScriptThreadEventCategory::NetworkEvent, msg))
} }

View file

@ -11,7 +11,7 @@ use dom::globalscope::GlobalScope;
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory}; use script_runtime::{CommonScriptMsg, ScriptChan, ScriptThreadEventCategory};
use std::fmt; use std::fmt;
use std::result::Result; use std::result::Result;
use task::{Task, TaskCanceller}; use task::{TaskBox, TaskCanceller};
use task_source::TaskSource; use task_source::TaskSource;
#[derive(JSTraceable)] #[derive(JSTraceable)]
@ -36,7 +36,7 @@ impl TaskSource for PerformanceTimelineTaskSource {
canceller: &TaskCanceller, canceller: &TaskCanceller,
) -> Result<(), ()> ) -> Result<(), ()>
where where
T: Task + 'static, T: TaskBox + 'static,
{ {
let msg = CommonScriptMsg::Task( let msg = CommonScriptMsg::Task(
ScriptThreadEventCategory::PerformanceTimelineTask, ScriptThreadEventCategory::PerformanceTimelineTask,

View file

@ -13,7 +13,7 @@ use servo_atoms::Atom;
use std::fmt; use std::fmt;
use std::result::Result; use std::result::Result;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
use task::{Task, TaskCanceller}; use task::{TaskBox, TaskCanceller};
use task_source::TaskSource; use task_source::TaskSource;
#[derive(Clone, JSTraceable)] #[derive(Clone, JSTraceable)]
@ -32,7 +32,7 @@ impl TaskSource for UserInteractionTaskSource {
canceller: &TaskCanceller, canceller: &TaskCanceller,
) -> Result<(), ()> ) -> Result<(), ()>
where where
T: Task + 'static, T: TaskBox + 'static,
{ {
let msg = MainThreadScriptMsg::Common(CommonScriptMsg::Task( let msg = MainThreadScriptMsg::Common(CommonScriptMsg::Task(
ScriptThreadEventCategory::InputEvent, ScriptThreadEventCategory::InputEvent,