mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Rename Task to TaskBox
This commit is contained in:
parent
f088b708c9
commit
52527d6f9d
19 changed files with 71 additions and 69 deletions
|
@ -40,7 +40,7 @@ use std::marker::PhantomData;
|
|||
use std::os;
|
||||
use std::rc::Rc;
|
||||
use std::sync::{Arc, Weak};
|
||||
use task::Task;
|
||||
use task::TaskBox;
|
||||
|
||||
|
||||
#[allow(missing_docs)] // FIXME
|
||||
|
@ -122,7 +122,7 @@ impl TrustedPromise {
|
|||
|
||||
/// A task which will reject the promise.
|
||||
#[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;
|
||||
task!(reject_promise: move || {
|
||||
debug!("Rejecting promise.");
|
||||
|
@ -135,7 +135,7 @@ impl TrustedPromise {
|
|||
|
||||
/// A task which will resolve the promise.
|
||||
#[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
|
||||
T: ToJSValConvertible + Send,
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ use std::collections::HashMap;
|
|||
use std::rc::Rc;
|
||||
use std::str::FromStr;
|
||||
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 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,
|
||||
}
|
||||
|
||||
impl<T> Task for ListenerTask<T>
|
||||
impl<T> TaskBox for ListenerTask<T>
|
||||
where
|
||||
T: AsyncBluetoothListener + DomObject,
|
||||
{
|
||||
fn run(self: Box<Self>) {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let this = *self;
|
||||
let mut context = this.context.lock().unwrap();
|
||||
context.response(this.action);
|
||||
|
|
|
@ -119,7 +119,7 @@ use style::thread_state;
|
|||
use style::values::{CSSFloat, Either};
|
||||
use style::values::{specified, computed};
|
||||
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,
|
||||
// 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)]
|
||||
fn run(self: Box<Self>) {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let element = self.element.root();
|
||||
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)]
|
||||
fn run(self: Box<Self>) {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let element = self.element.root();
|
||||
let document = document_from_node(element.r());
|
||||
// TODO Step 9.1-5
|
||||
|
|
|
@ -23,7 +23,7 @@ use dom_struct::dom_struct;
|
|||
use servo_atoms::Atom;
|
||||
use std::cell::Cell;
|
||||
use std::default::Default;
|
||||
use task::Task;
|
||||
use task::TaskBox;
|
||||
use time;
|
||||
|
||||
#[dom_struct]
|
||||
|
@ -388,8 +388,8 @@ pub struct EventTask {
|
|||
pub cancelable: EventCancelable,
|
||||
}
|
||||
|
||||
impl Task for EventTask {
|
||||
fn run(self: Box<Self>) {
|
||||
impl TaskBox for EventTask {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let target = self.target.root();
|
||||
let bubbles = self.bubbles;
|
||||
let cancelable = self.cancelable;
|
||||
|
@ -403,8 +403,8 @@ pub struct SimpleEventTask {
|
|||
pub name: Atom,
|
||||
}
|
||||
|
||||
impl Task for SimpleEventTask {
|
||||
fn run(self: Box<Self>) {
|
||||
impl TaskBox for SimpleEventTask {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let target = self.target.root();
|
||||
target.fire_event(self.name);
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ use js::jsapi::{HandleValue, JSContext};
|
|||
use script_traits::{ScriptMsg, DOMMessage};
|
||||
use servo_url::ServoUrl;
|
||||
use std::cell::Cell;
|
||||
use task::Task;
|
||||
use task::TaskBox;
|
||||
|
||||
pub type TrustedServiceWorkerAddress = Trusted<ServiceWorker>;
|
||||
|
||||
|
@ -104,9 +104,9 @@ impl ServiceWorkerMethods for ServiceWorker {
|
|||
event_handler!(statechange, GetOnstatechange, SetOnstatechange);
|
||||
}
|
||||
|
||||
impl Task for SimpleWorkerErrorHandler<ServiceWorker> {
|
||||
impl TaskBox for SimpleWorkerErrorHandler<ServiceWorker> {
|
||||
#[allow(unrooted_must_root)]
|
||||
fn run(self: Box<Self>) {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let this = *self;
|
||||
ServiceWorker::dispatch_simple_error(this.addr);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ use std::borrow::ToOwned;
|
|||
use std::cell::Cell;
|
||||
use std::ptr;
|
||||
use std::thread;
|
||||
use task::{Task, TaskCanceller};
|
||||
use task::{TaskBox, TaskCanceller};
|
||||
use task_source::TaskSource;
|
||||
use task_source::networking::NetworkingTaskSource;
|
||||
|
||||
|
@ -397,9 +397,9 @@ struct ConnectionEstablishedTask {
|
|||
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
|
||||
fn run(self: Box<Self>) {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let ws = self.address.root();
|
||||
|
||||
// Step 1.
|
||||
|
@ -422,13 +422,13 @@ struct BufferedAmountTask {
|
|||
address: Trusted<WebSocket>,
|
||||
}
|
||||
|
||||
impl Task for BufferedAmountTask {
|
||||
impl TaskBox for BufferedAmountTask {
|
||||
// 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
|
||||
// reaches step 1. In our implementation, the bytes will already have been sent on a background
|
||||
// thread.
|
||||
fn run(self: Box<Self>) {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let ws = self.address.root();
|
||||
|
||||
ws.buffered_amount.set(0);
|
||||
|
@ -443,8 +443,8 @@ struct CloseTask {
|
|||
reason: Option<String>,
|
||||
}
|
||||
|
||||
impl Task for CloseTask {
|
||||
fn run(self: Box<Self>) {
|
||||
impl TaskBox for CloseTask {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let ws = self.address.root();
|
||||
|
||||
if ws.ready_state.get() == WebSocketRequestState::Closed {
|
||||
|
@ -483,9 +483,9 @@ struct MessageReceivedTask {
|
|||
message: MessageData,
|
||||
}
|
||||
|
||||
impl Task for MessageReceivedTask {
|
||||
impl TaskBox for MessageReceivedTask {
|
||||
#[allow(unsafe_code)]
|
||||
fn run(self: Box<Self>) {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let ws = self.address.root();
|
||||
debug!("MessageReceivedTask::handler({:p}): readyState={:?}", &*ws,
|
||||
ws.ready_state.get());
|
||||
|
|
|
@ -28,7 +28,7 @@ use std::cell::Cell;
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::mpsc::{Sender, channel};
|
||||
use task::Task;
|
||||
use task::TaskBox;
|
||||
|
||||
pub type TrustedWorkerAddress = Trusted<Worker>;
|
||||
|
||||
|
@ -175,9 +175,9 @@ impl WorkerMethods for Worker {
|
|||
event_handler!(error, GetOnerror, SetOnerror);
|
||||
}
|
||||
|
||||
impl Task for SimpleWorkerErrorHandler<Worker> {
|
||||
impl TaskBox for SimpleWorkerErrorHandler<Worker> {
|
||||
#[allow(unrooted_must_root)]
|
||||
fn run(self: Box<Self>) {
|
||||
fn run_box(self: Box<Self>) {
|
||||
let this = *self;
|
||||
Worker::dispatch_simple_error(this.addr);
|
||||
}
|
||||
|
|
|
@ -388,7 +388,7 @@ impl WorkerGlobalScope {
|
|||
pub fn process_event(&self, msg: CommonScriptMsg) {
|
||||
match msg {
|
||||
CommonScriptMsg::Task(_, task) => {
|
||||
task.run()
|
||||
task.run_box()
|
||||
},
|
||||
CommonScriptMsg::CollectReports(reports_chan) => {
|
||||
let cx = self.get_cx();
|
||||
|
|
|
@ -69,7 +69,7 @@ use std::thread;
|
|||
use style::thread_state;
|
||||
use swapper::Swapper;
|
||||
use swapper::swapper;
|
||||
use task::Task;
|
||||
use task::TaskBox;
|
||||
use uuid::Uuid;
|
||||
|
||||
// Magic numbers
|
||||
|
@ -647,7 +647,7 @@ impl WorkletThread {
|
|||
/// Run a task in the main script thread.
|
||||
fn run_in_script_thread<T>(&self, task: T)
|
||||
where
|
||||
T: Task + 'static,
|
||||
T: TaskBox + 'static,
|
||||
{
|
||||
let msg = CommonScriptMsg::Task(ScriptThreadEventCategory::WorkletEvent, box task);
|
||||
let msg = MainThreadScriptMsg::Common(msg);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue