aboutsummaryrefslogtreecommitdiffstats
path: root/components/script
diff options
context:
space:
mode:
authorrohan.prinja <rohan.prinja@samsung.com>2015-11-14 05:07:55 +0900
committerRohan Prinja <rohan.prinja@gmail.com>2016-01-10 17:58:13 +0900
commit1f02c4ebbb7d5ea49051f4391f1418f20c15d7a9 (patch)
tree7d61e58e746ddca93074ca6bca6849360a098b8c /components/script
parentf00532bab0382d1c24e6086314f26497fb6ffe0f (diff)
downloadservo-1f02c4ebbb7d5ea49051f4391f1418f20c15d7a9.tar.gz
servo-1f02c4ebbb7d5ea49051f4391f1418f20c15d7a9.zip
task -> thread
Diffstat (limited to 'components/script')
-rw-r--r--components/script/cors.rs6
-rw-r--r--components/script/devtools.rs2
-rw-r--r--components/script/document_loader.rs16
-rw-r--r--components/script/dom/bindings/cell.rs20
-rw-r--r--components/script/dom/bindings/global.rs42
-rw-r--r--components/script/dom/bindings/js.rs60
-rw-r--r--components/script/dom/bindings/refcounted.rs20
-rw-r--r--components/script/dom/bindings/trace.rs8
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs6
-rw-r--r--components/script/dom/closeevent.rs2
-rw-r--r--components/script/dom/dedicatedworkerglobalscope.rs21
-rw-r--r--components/script/dom/document.rs8
-rw-r--r--components/script/dom/filereader.rs24
-rw-r--r--components/script/dom/htmlcanvaselement.rs4
-rw-r--r--components/script/dom/htmlformelement.rs2
-rw-r--r--components/script/dom/htmlimageelement.rs14
-rw-r--r--components/script/dom/htmlinputelement.rs6
-rw-r--r--components/script/dom/htmllinkelement.rs2
-rw-r--r--components/script/dom/htmlscriptelement.rs10
-rw-r--r--components/script/dom/mod.rs4
-rw-r--r--components/script/dom/node.rs10
-rw-r--r--components/script/dom/servohtmlparser.rs6
-rw-r--r--components/script/dom/servoxmlparser.rs4
-rw-r--r--components/script/dom/storage.rs36
-rw-r--r--components/script/dom/webglrenderingcontext.rs6
-rw-r--r--components/script/dom/webglshader.rs4
-rw-r--r--components/script/dom/websocket.rs38
-rw-r--r--components/script/dom/window.rs118
-rw-r--r--components/script/dom/worker.rs12
-rw-r--r--components/script/dom/workerglobalscope.rs16
-rw-r--r--components/script/dom/xmlhttprequest.rs28
-rw-r--r--components/script/layout_interface.rs28
-rw-r--r--components/script/lib.rs4
-rw-r--r--components/script/network_listener.rs4
-rw-r--r--components/script/script_thread.rs (renamed from components/script/script_task.rs)404
-rw-r--r--components/script/timers.rs2
-rw-r--r--components/script/webdriver_handlers.rs2
37 files changed, 502 insertions, 497 deletions
diff --git a/components/script/cors.rs b/components/script/cors.rs
index 786d12d94ae..7bf5127a22e 100644
--- a/components/script/cors.rs
+++ b/components/script/cors.rs
@@ -20,7 +20,7 @@ use hyper::mime::{Mime, SubLevel, TopLevel};
use hyper::status::StatusClass::Success;
use net_traits::{AsyncResponseListener, Metadata, ResponseAction};
use network_listener::{NetworkListener, PreInvoke};
-use script_task::ScriptChan;
+use script_thread::ScriptChan;
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::sync::{Arc, Mutex};
@@ -28,7 +28,7 @@ use time::{self, Timespec, now};
use unicase::UniCase;
use url::{SchemeData, Url};
use util::mem::HeapSizeOf;
-use util::task::spawn_named;
+use util::thread::spawn_named;
/// Interface for network listeners concerned with CORS checks. Proper network requests
/// should be initiated from this method, based on the response provided.
@@ -141,7 +141,7 @@ impl CORSRequest {
};
// TODO: this exists only to make preflight check non-blocking
- // perhaps should be handled by the resource task?
+ // perhaps should be handled by the resource thread?
let req = self.clone();
spawn_named("cors".to_owned(), move || {
let response = req.http_fetch();
diff --git a/components/script/devtools.rs b/components/script/devtools.rs
index 8bdde1aa2d1..668c4554722 100644
--- a/components/script/devtools.rs
+++ b/components/script/devtools.rs
@@ -19,7 +19,7 @@ use js::jsapi::{ObjectClassName, RootedObject, RootedValue};
use js::jsval::UndefinedValue;
use msg::constellation_msg::PipelineId;
use page::{IterablePage, Page};
-use script_task::get_page;
+use script_thread::get_page;
use std::ffi::CStr;
use std::rc::Rc;
use std::str;
diff --git a/components/script/document_loader.rs b/components/script/document_loader.rs
index f5e49c46785..e0da74ae706 100644
--- a/components/script/document_loader.rs
+++ b/components/script/document_loader.rs
@@ -7,7 +7,7 @@
use msg::constellation_msg::PipelineId;
use net_traits::AsyncResponseTarget;
-use net_traits::{PendingAsyncLoad, ResourceTask, LoadContext};
+use net_traits::{PendingAsyncLoad, ResourceThread, LoadContext};
use std::sync::Arc;
use url::Url;
@@ -43,10 +43,10 @@ impl LoadType {
#[derive(JSTraceable, HeapSizeOf)]
pub struct DocumentLoader {
- /// We use an `Arc<ResourceTask>` here in order to avoid file descriptor exhaustion when there
+ /// We use an `Arc<ResourceThread>` here in order to avoid file descriptor exhaustion when there
/// are lots of iframes.
#[ignore_heap_size_of = "channels are hard"]
- pub resource_task: Arc<ResourceTask>,
+ pub resource_thread: Arc<ResourceThread>,
pipeline: Option<PipelineId>,
blocking_loads: Vec<LoadType>,
events_inhibited: bool,
@@ -54,19 +54,19 @@ pub struct DocumentLoader {
impl DocumentLoader {
pub fn new(existing: &DocumentLoader) -> DocumentLoader {
- DocumentLoader::new_with_task(existing.resource_task.clone(), None, None)
+ DocumentLoader::new_with_thread(existing.resource_thread.clone(), None, None)
}
- /// We use an `Arc<ResourceTask>` here in order to avoid file descriptor exhaustion when there
+ /// We use an `Arc<ResourceThread>` here in order to avoid file descriptor exhaustion when there
/// are lots of iframes.
- pub fn new_with_task(resource_task: Arc<ResourceTask>,
+ pub fn new_with_thread(resource_thread: Arc<ResourceThread>,
pipeline: Option<PipelineId>,
initial_load: Option<Url>)
-> DocumentLoader {
let initial_loads = initial_load.into_iter().map(LoadType::PageSource).collect();
DocumentLoader {
- resource_task: resource_task,
+ resource_thread: resource_thread,
pipeline: pipeline,
blocking_loads: initial_loads,
events_inhibited: false,
@@ -79,7 +79,7 @@ impl DocumentLoader {
let context = load.to_load_context();
let url = load.url().clone();
self.blocking_loads.push(load);
- PendingAsyncLoad::new(context, (*self.resource_task).clone(), url, self.pipeline)
+ PendingAsyncLoad::new(context, (*self.resource_thread).clone(), url, self.pipeline)
}
/// Create and initiate a new network request.
diff --git a/components/script/dom/bindings/cell.rs b/components/script/dom/bindings/cell.rs
index 50093457397..37143165a7d 100644
--- a/components/script/dom/bindings/cell.rs
+++ b/components/script/dom/bindings/cell.rs
@@ -7,8 +7,8 @@
use dom::bindings::trace::JSTraceable;
use js::jsapi::JSTracer;
use std::cell::{BorrowState, Ref, RefCell, RefMut};
-use util::task_state;
-use util::task_state::SCRIPT;
+use util::thread_state;
+use util::thread_state::SCRIPT;
/// A mutable field in the DOM.
///
@@ -25,10 +25,10 @@ pub struct DOMRefCell<T> {
impl<T> DOMRefCell<T> {
/// Return a reference to the contents.
///
- /// For use in the layout task only.
+ /// For use in the layout thread only.
#[allow(unsafe_code)]
pub unsafe fn borrow_for_layout(&self) -> &T {
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
&*self.value.as_unsafe_cell().get()
}
@@ -40,7 +40,7 @@ impl<T> DOMRefCell<T> {
pub unsafe fn borrow_for_gc_trace(&self) -> &T {
// FIXME: IN_GC isn't reliable enough - doesn't catch minor GCs
// https://github.com/servo/servo/issues/6389
- // debug_assert!(task_state::get().contains(SCRIPT | IN_GC));
+ // debug_assert!(thread_state::get().contains(SCRIPT | IN_GC));
&*self.value.as_unsafe_cell().get()
}
@@ -48,7 +48,7 @@ impl<T> DOMRefCell<T> {
///
#[allow(unsafe_code)]
pub unsafe fn borrow_for_script_deallocation(&self) -> &mut T {
- debug_assert!(task_state::get().contains(SCRIPT));
+ debug_assert!(thread_state::get().contains(SCRIPT));
&mut *self.value.as_unsafe_cell().get()
}
@@ -70,7 +70,7 @@ impl<T> DOMRefCell<T> {
///
/// Panics if this is called off the script thread.
pub fn try_borrow(&self) -> Option<Ref<T>> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
match self.value.borrow_state() {
BorrowState::Writing => None,
_ => Some(self.value.borrow()),
@@ -88,17 +88,17 @@ impl<T> DOMRefCell<T> {
///
/// Panics if this is called off the script thread.
pub fn try_borrow_mut(&self) -> Option<RefMut<T>> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
match self.value.borrow_state() {
BorrowState::Unused => Some(self.value.borrow_mut()),
_ => None,
}
}
- /// Version of the above that we use during restyle while the script task
+ /// Version of the above that we use during restyle while the script thread
/// is blocked.
pub fn borrow_mut_for_layout(&self) -> RefMut<T> {
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
self.value.borrow_mut()
}
}
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index d3ece2ae98e..8e455d29f28 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -19,9 +19,9 @@ use js::jsapi::GetGlobalForObjectCrossCompartment;
use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
use msg::constellation_msg::{ConstellationChan, PipelineId};
-use net_traits::ResourceTask;
+use net_traits::ResourceThread;
use profile_traits::mem;
-use script_task::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptTask};
+use script_thread::{CommonScriptMsg, ScriptChan, ScriptPort, ScriptThread};
use script_traits::{MsDuration, ScriptMsg as ConstellationMsg, TimerEventRequest};
use timers::{ScheduledCallback, TimerHandle};
use url::Url;
@@ -65,7 +65,7 @@ impl<'a> GlobalRef<'a> {
}
}
- /// Extract a `Window`, causing task failure if the global object is not
+ /// Extract a `Window`, causing thread failure if the global object is not
/// a `Window`.
pub fn as_window(&self) -> &window::Window {
match *self {
@@ -82,7 +82,7 @@ impl<'a> GlobalRef<'a> {
}
}
- /// Get a `mem::ProfilerChan` to send messages to the memory profiler task.
+ /// Get a `mem::ProfilerChan` to send messages to the memory profiler thread.
pub fn mem_profiler_chan(&self) -> mem::ProfilerChan {
match *self {
GlobalRef::Window(window) => window.mem_profiler_chan(),
@@ -107,7 +107,7 @@ impl<'a> GlobalRef<'a> {
}
/// Get an `IpcSender<ScriptToDevtoolsControlMsg>` to send messages to Devtools
- /// task when available.
+ /// thread when available.
pub fn devtools_chan(&self) -> Option<IpcSender<ScriptToDevtoolsControlMsg>> {
match *self {
GlobalRef::Window(window) => window.devtools_chan(),
@@ -115,16 +115,16 @@ impl<'a> GlobalRef<'a> {
}
}
- /// Get the `ResourceTask` for this global scope.
- pub fn resource_task(&self) -> ResourceTask {
+ /// Get the `ResourceThread` for this global scope.
+ pub fn resource_thread(&self) -> ResourceThread {
match *self {
GlobalRef::Window(ref window) => {
let doc = window.Document();
let doc = doc.r();
let loader = doc.loader();
- (*loader.resource_task).clone()
+ (*loader.resource_thread).clone()
}
- GlobalRef::Worker(ref worker) => worker.resource_task().clone(),
+ GlobalRef::Worker(ref worker) => worker.resource_thread().clone(),
}
}
@@ -154,45 +154,45 @@ impl<'a> GlobalRef<'a> {
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
- pub fn dom_manipulation_task_source(&self) -> Box<ScriptChan + Send> {
+ pub fn dom_manipulation_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
- GlobalRef::Window(ref window) => window.dom_manipulation_task_source(),
+ GlobalRef::Window(ref window) => window.dom_manipulation_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
- pub fn user_interaction_task_source(&self) -> Box<ScriptChan + Send> {
+ pub fn user_interaction_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
- GlobalRef::Window(ref window) => window.user_interaction_task_source(),
+ GlobalRef::Window(ref window) => window.user_interaction_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
- pub fn networking_task_source(&self) -> Box<ScriptChan + Send> {
+ pub fn networking_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
- GlobalRef::Window(ref window) => window.networking_task_source(),
+ GlobalRef::Window(ref window) => window.networking_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
- pub fn history_traversal_task_source(&self) -> Box<ScriptChan + Send> {
+ pub fn history_traversal_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
- GlobalRef::Window(ref window) => window.history_traversal_task_source(),
+ GlobalRef::Window(ref window) => window.history_traversal_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
/// `ScriptChan` used to send messages to the event loop of this global's
/// thread.
- pub fn file_reading_task_source(&self) -> Box<ScriptChan + Send> {
+ pub fn file_reading_thread_source(&self) -> Box<ScriptChan + Send> {
match *self {
- GlobalRef::Window(ref window) => window.file_reading_task_source(),
+ GlobalRef::Window(ref window) => window.file_reading_thread_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(),
}
}
@@ -207,11 +207,11 @@ impl<'a> GlobalRef<'a> {
}
}
- /// Process a single event as if it were the next event in the task queue for
+ /// Process a single event as if it were the next event in the thread queue for
/// this global.
pub fn process_event(&self, msg: CommonScriptMsg) {
match *self {
- GlobalRef::Window(_) => ScriptTask::process_event(msg),
+ GlobalRef::Window(_) => ScriptThread::process_event(msg),
GlobalRef::Worker(ref worker) => worker.process_event(msg),
}
}
diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs
index dfe1acca376..5fb452883f3 100644
--- a/components/script/dom/bindings/js.rs
+++ b/components/script/dom/bindings/js.rs
@@ -33,7 +33,7 @@ use dom::node::Node;
use js::jsapi::{Heap, JSObject, JSTracer};
use js::jsval::JSVal;
use layout_interface::TrustedNodeAddress;
-use script_task::STACK_ROOTS;
+use script_thread::STACK_ROOTS;
use std::cell::UnsafeCell;
use std::default::Default;
use std::hash::{Hash, Hasher};
@@ -41,7 +41,7 @@ use std::mem;
use std::ops::Deref;
use std::ptr;
use util::mem::HeapSizeOf;
-use util::task_state;
+use util::thread_state;
/// A traced reference to a DOM object
///
@@ -66,7 +66,7 @@ impl<T> HeapSizeOf for JS<T> {
impl<T> JS<T> {
/// Returns `LayoutJS<T>` containing the same pointer.
pub unsafe fn to_layout(&self) -> LayoutJS<T> {
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
LayoutJS {
ptr: self.ptr.clone(),
}
@@ -78,7 +78,7 @@ impl<T: Reflectable> JS<T> {
/// XXX Not a great API. Should be a call on Root<T> instead
#[allow(unrooted_must_root)]
pub fn from_rooted(root: &Root<T>) -> JS<T> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
JS {
ptr: unsafe { NonZero::new(&**root) },
}
@@ -86,7 +86,7 @@ impl<T: Reflectable> JS<T> {
/// Create a JS<T> from a &T
#[allow(unrooted_must_root)]
pub fn from_ref(obj: &T) -> JS<T> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
JS {
ptr: unsafe { NonZero::new(&*obj) },
}
@@ -97,7 +97,7 @@ impl<T: Reflectable> Deref for JS<T> {
type Target = T;
fn deref(&self) -> &T {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
// We can only have &JS<T> from a rooted thing, so it's safe to deref
// it to &T.
unsafe { &**self.ptr }
@@ -123,7 +123,7 @@ impl<T: Castable> LayoutJS<T> {
where U: Castable,
T: DerivedFrom<U>
{
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
unsafe { mem::transmute_copy(self) }
}
@@ -131,7 +131,7 @@ impl<T: Castable> LayoutJS<T> {
pub fn downcast<U>(&self) -> Option<LayoutJS<U>>
where U: DerivedFrom<T>
{
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
unsafe {
if (*self.unsafe_get()).is::<U>() {
Some(mem::transmute_copy(self))
@@ -145,7 +145,7 @@ impl<T: Castable> LayoutJS<T> {
impl<T: Reflectable> LayoutJS<T> {
/// Get the reflector.
pub unsafe fn get_jsobject(&self) -> *mut JSObject {
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
(**self.ptr).reflector().get_jsobject().get()
}
}
@@ -184,7 +184,7 @@ impl <T> Clone for JS<T> {
#[inline]
#[allow(unrooted_must_root)]
fn clone(&self) -> JS<T> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
JS {
ptr: self.ptr.clone(),
}
@@ -194,7 +194,7 @@ impl <T> Clone for JS<T> {
impl <T> Clone for LayoutJS<T> {
#[inline]
fn clone(&self) -> LayoutJS<T> {
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
LayoutJS {
ptr: self.ptr.clone(),
}
@@ -205,7 +205,7 @@ impl LayoutJS<Node> {
/// Create a new JS-owned value wrapped from an address known to be a
/// `Node` pointer.
pub unsafe fn from_trusted_node_address(inner: TrustedNodeAddress) -> LayoutJS<Node> {
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
let TrustedNodeAddress(addr) = inner;
LayoutJS {
ptr: NonZero::new(addr as *const Node),
@@ -240,7 +240,7 @@ pub struct MutHeapJSVal {
impl MutHeapJSVal {
/// Create a new `MutHeapJSVal`.
pub fn new() -> MutHeapJSVal {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
MutHeapJSVal {
val: UnsafeCell::new(Heap::default()),
}
@@ -249,7 +249,7 @@ impl MutHeapJSVal {
/// Set this `MutHeapJSVal` to the given value, calling write barriers as
/// appropriate.
pub fn set(&self, val: JSVal) {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
unsafe {
let cell = self.val.get();
(*cell).set(val);
@@ -258,7 +258,7 @@ impl MutHeapJSVal {
/// Get the value in this `MutHeapJSVal`, calling read barriers as appropriate.
pub fn get(&self) -> JSVal {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
unsafe { (*self.val.get()).get() }
}
}
@@ -278,7 +278,7 @@ pub struct MutHeap<T: HeapGCValue> {
impl<T: Reflectable> MutHeap<JS<T>> {
/// Create a new `MutHeap`.
pub fn new(initial: &T) -> MutHeap<JS<T>> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
MutHeap {
val: UnsafeCell::new(JS::from_ref(initial)),
}
@@ -286,7 +286,7 @@ impl<T: Reflectable> MutHeap<JS<T>> {
/// Set this `MutHeap` to the given value.
pub fn set(&self, val: &T) {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
unsafe {
*self.val.get() = JS::from_ref(val);
}
@@ -294,7 +294,7 @@ impl<T: Reflectable> MutHeap<JS<T>> {
/// Get the value in this `MutHeap`.
pub fn get(&self) -> Root<T> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
unsafe {
Root::from_ref(&*ptr::read(self.val.get()))
}
@@ -339,7 +339,7 @@ pub struct MutNullableHeap<T: HeapGCValue> {
impl<T: Reflectable> MutNullableHeap<JS<T>> {
/// Create a new `MutNullableHeap`.
pub fn new(initial: Option<&T>) -> MutNullableHeap<JS<T>> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
MutNullableHeap {
ptr: UnsafeCell::new(initial.map(JS::from_ref)),
}
@@ -350,7 +350,7 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
pub fn or_init<F>(&self, cb: F) -> Root<T>
where F: FnOnce() -> Root<T>
{
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
match self.get() {
Some(inner) => inner,
None => {
@@ -365,14 +365,14 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
/// For use by layout, which can't use safe types like Temporary.
#[allow(unrooted_must_root)]
pub unsafe fn get_inner_as_layout(&self) -> Option<LayoutJS<T>> {
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
ptr::read(self.ptr.get()).map(|js| js.to_layout())
}
/// Get a rooted value out of this object
#[allow(unrooted_must_root)]
pub fn get(&self) -> Option<Root<T>> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
unsafe {
ptr::read(self.ptr.get()).map(|o| Root::from_ref(&*o))
}
@@ -380,7 +380,7 @@ impl<T: Reflectable> MutNullableHeap<JS<T>> {
/// Set this `MutNullableHeap` to the given value.
pub fn set(&self, val: Option<&T>) {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
unsafe {
*self.ptr.get() = val.map(|p| JS::from_ref(p));
}
@@ -407,7 +407,7 @@ impl<'a, T: Reflectable> PartialEq<Option<&'a T>> for MutNullableHeap<JS<T>> {
impl<T: HeapGCValue> Default for MutNullableHeap<T> {
#[allow(unrooted_must_root)]
fn default() -> MutNullableHeap<T> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
MutNullableHeap {
ptr: UnsafeCell::new(None),
}
@@ -426,7 +426,7 @@ impl<T: Reflectable> LayoutJS<T> {
/// the only method that be safely accessed from layout. (The fact that
/// this is unsafe is what necessitates the layout wrappers.)
pub unsafe fn unsafe_get(&self) -> *const T {
- debug_assert!(task_state::get().is_layout());
+ debug_assert!(thread_state::get().is_layout());
*self.ptr
}
}
@@ -479,7 +479,7 @@ impl Clone for RootCollectionPtr {
impl RootCollection {
/// Create an empty collection of roots
pub fn new() -> RootCollection {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
RootCollection {
roots: UnsafeCell::new(vec![]),
}
@@ -487,7 +487,7 @@ impl RootCollection {
/// Start tracking a stack-based root
fn root(&self, untracked_reflector: *const Reflector) {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
unsafe {
let mut roots = &mut *self.roots.get();
roots.push(untracked_reflector);
@@ -497,7 +497,7 @@ impl RootCollection {
/// Stop tracking a stack-based root, asserting if the reflector isn't found
fn unroot<T: Reflectable>(&self, rooted: &Root<T>) {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
unsafe {
let mut roots = &mut *self.roots.get();
let old_reflector = &*rooted.reflector();
@@ -562,7 +562,7 @@ impl<T: Reflectable> Root<T> {
/// It cannot not outlive its associated `RootCollection`, and it gives
/// out references which cannot outlive this new `Root`.
pub fn new(unrooted: NonZero<*const T>) -> Root<T> {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
STACK_ROOTS.with(|ref collection| {
let RootCollectionPtr(collection) = collection.get().unwrap();
unsafe { (*collection).root(&*(**unrooted).reflector()) }
@@ -588,7 +588,7 @@ impl<T: Reflectable> Root<T> {
impl<T: Reflectable> Deref for Root<T> {
type Target = T;
fn deref(&self) -> &T {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
unsafe { &**self.ptr.deref() }
}
}
diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs
index 4c884854c13..c7d67cba5fd 100644
--- a/components/script/dom/bindings/refcounted.rs
+++ b/components/script/dom/bindings/refcounted.rs
@@ -3,21 +3,21 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! A generic, safe mechanism by which DOM objects can be pinned and transferred
-//! between tasks (or intra-task for asynchronous events). Akin to Gecko's
+//! between threads (or intra-thread for asynchronous events). Akin to Gecko's
//! nsMainThreadPtrHandle, this uses thread-safe reference counting and ensures
-//! that the actual SpiderMonkey GC integration occurs on the script task via
+//! that the actual SpiderMonkey GC integration occurs on the script thread via
//! message passing. Ownership of a `Trusted<T>` object means the DOM object of
//! type T to which it points remains alive. Any other behaviour is undefined.
//! To guarantee the lifetime of a DOM object when performing asynchronous operations,
//! obtain a `Trusted<T>` from that object and pass it along with each operation.
-//! A usable pointer to the original DOM object can be obtained on the script task
+//! A usable pointer to the original DOM object can be obtained on the script thread
//! from a `Trusted<T>` via the `to_temporary` method.
//!
//! The implementation of Trusted<T> is as follows:
-//! A hashtable resides in the script task, keyed on the pointer to the Rust DOM object.
+//! A hashtable resides in the script thread, keyed on the pointer to the Rust DOM object.
//! The values in this hashtable are atomic reference counts. When a Trusted<T> object is
//! created or cloned, this count is increased. When a Trusted<T> is dropped, the count
-//! decreases. If the count hits zero, a message is dispatched to the script task to remove
+//! decreases. If the count hits zero, a message is dispatched to the script thread to remove
//! the entry from the hashmap if the count is still zero. The JS reflector for the DOM object
//! is rooted when a hashmap entry is first created, and unrooted when the hashmap entry
//! is removed.
@@ -28,7 +28,7 @@ use dom::bindings::reflector::{Reflectable, Reflector};
use dom::bindings::trace::trace_reflector;
use js::jsapi::JSTracer;
use libc;
-use script_task::{CommonScriptMsg, ScriptChan};
+use script_thread::{CommonScriptMsg, ScriptChan};
use std::cell::RefCell;
use std::collections::hash_map::Entry::{Occupied, Vacant};
use std::collections::hash_map::HashMap;
@@ -52,13 +52,13 @@ pub struct TrustedReference(*const libc::c_void);
unsafe impl Send for TrustedReference {}
/// A safe wrapper around a raw pointer to a DOM object that can be
-/// shared among tasks for use in asynchronous operations. The underlying
+/// shared among threads for use in asynchronous operations. The underlying
/// DOM object is guaranteed to live at least as long as the last outstanding
/// `Trusted<T>` instance.
#[allow_unrooted_interior]
pub struct Trusted<T: Reflectable> {
/// A pointer to the Rust DOM object of type T, but void to allow
- /// sending `Trusted<T>` between tasks, regardless of T's sendability.
+ /// sending `Trusted<T>` between threads, regardless of T's sendability.
ptr: *const libc::c_void,
refcount: Arc<Mutex<usize>>,
script_chan: Box<ScriptChan + Send>,
@@ -125,7 +125,7 @@ impl<T: Reflectable> Drop for Trusted<T> {
assert!(*refcount > 0);
*refcount -= 1;
if *refcount == 0 {
- // It's possible this send will fail if the script task
+ // It's possible this send will fail if the script thread
// has already exited. There's not much we can do at this
// point though.
let msg = CommonScriptMsg::RefcountCleanup(TrustedReference(self.ptr));
@@ -142,7 +142,7 @@ pub struct LiveDOMReferences {
}
impl LiveDOMReferences {
- /// Set up the task-local data required for storing the outstanding DOM references.
+ /// Set up the thread-local data required for storing the outstanding DOM references.
pub fn initialize() {
LIVE_REFERENCES.with(|ref r| {
*r.borrow_mut() = Some(LiveDOMReferences {
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index 496d70add18..aec55e62134 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -58,11 +58,11 @@ use msg::constellation_msg::ConstellationChan;
use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData};
use net_traits::Metadata;
use net_traits::image::base::Image;
-use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask};
-use net_traits::storage_task::StorageType;
+use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
+use net_traits::storage_thread::StorageType;
use profile_traits::mem::ProfilerChan as MemProfilerChan;
use profile_traits::time::ProfilerChan as TimeProfilerChan;
-use script_task::ScriptChan;
+use script_thread::ScriptChan;
use script_traits::{LayoutMsg, ScriptMsg, TimerEventId, TimerSource, UntrustedNodeAddress};
use selectors::parser::PseudoElement;
use selectors::states::*;
@@ -262,7 +262,7 @@ no_jsmanaged_fields!(Receiver<T>);
no_jsmanaged_fields!(Rect<T>);
no_jsmanaged_fields!(Size2D<T>);
no_jsmanaged_fields!(Arc<T>);
-no_jsmanaged_fields!(Image, ImageCacheChan, ImageCacheTask);
+no_jsmanaged_fields!(Image, ImageCacheChan, ImageCacheThread);
no_jsmanaged_fields!(Metadata);
no_jsmanaged_fields!(Atom, Namespace, QualName);
no_jsmanaged_fields!(Trusted<T: Reflectable>);
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index ef010055d6f..717494d80c6 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -2,7 +2,7 @@
* 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 canvas::canvas_paint_task::RectToi32;
+use canvas::canvas_paint_thread::RectToi32;
use canvas_traits::{Canvas2dMsg, CanvasCommonMsg, CanvasMsg};
use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle};
use canvas_traits::{FillOrStrokeStyle, FillRule, LinearGradientStyle, RadialGradientStyle, RepetitionStyle};
@@ -36,7 +36,7 @@ use euclid::rect::Rect;
use euclid::size::Size2D;
use ipc_channel::ipc::{self, IpcSender};
use net_traits::image::base::PixelFormat;
-use net_traits::image_cache_task::ImageResponse;
+use net_traits::image_cache_thread::ImageResponse;
use num::{Float, ToPrimitive};
use script_traits::ScriptMsg as ConstellationMsg;
use std::cell::Cell;
@@ -124,7 +124,7 @@ impl CanvasRenderingContext2D {
-> CanvasRenderingContext2D {
let (sender, receiver) = ipc::channel().unwrap();
let constellation_chan = global.constellation_chan();
- constellation_chan.0.send(ConstellationMsg::CreateCanvasPaintTask(size, sender)).unwrap();
+ constellation_chan.0.send(ConstellationMsg::CreateCanvasPaintThread(size, sender)).unwrap();
let (ipc_renderer, renderer_id) = receiver.recv().unwrap();
CanvasRenderingContext2D {
reflector_: Reflector::new(),
diff --git a/components/script/dom/closeevent.rs b/components/script/dom/closeevent.rs
index ca1186227e7..44635462ad2 100644
--- a/components/script/dom/closeevent.rs
+++ b/components/script/dom/closeevent.rs
@@ -11,7 +11,7 @@ use dom::bindings::inheritance::Castable;
use dom::bindings::js::Root;
use dom::bindings::reflector::reflect_dom_object;
use dom::event::{Event, EventBubbles, EventCancelable};
-use script_task::ScriptChan;
+use script_thread::ScriptChan;
use string_cache::Atom;
use util::str::DOMString;
diff --git a/components/script/dom/dedicatedworkerglobalscope.rs b/components/script/dom/dedicatedworkerglobalscope.rs
index 07bef0cd348..c63b657cd19 100644
--- a/components/script/dom/dedicatedworkerglobalscope.rs
+++ b/components/script/dom/dedicatedworkerglobalscope.rs
@@ -28,17 +28,17 @@ use js::rust::Runtime;
use msg::constellation_msg::PipelineId;
use net_traits::{LoadContext, load_whole_resource};
use rand::random;
-use script_task::ScriptTaskEventCategory::WorkerEvent;
-use script_task::{ScriptTask, ScriptChan, ScriptPort, StackRootTLS, CommonScriptMsg};
+use script_thread::ScriptThreadEventCategory::WorkerEvent;
+use script_thread::{ScriptThread, ScriptChan, ScriptPort, StackRootTLS, CommonScriptMsg};
use script_traits::{TimerEvent, TimerSource};
use std::mem::replace;
use std::rc::Rc;
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
use url::Url;
use util::str::DOMString;
-use util::task::spawn_named;
-use util::task_state;
-use util::task_state::{IN_WORKER, SCRIPT};
+use util::thread::spawn_named;
+use util::thread_state;
+use util::thread_state::{IN_WORKER, SCRIPT};
/// Messages used to control the worker event loops
pub enum WorkerScriptMsg {
@@ -215,12 +215,15 @@ impl DedicatedWorkerGlobalScope {
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>) {
let serialized_worker_url = worker_url.serialize();
spawn_named(format!("WebWorker for {}", serialized_worker_url), move || {
- task_state::initialize(SCRIPT | IN_WORKER);
+ thread_state::initialize(SCRIPT | IN_WORKER);
let roots = RootCollection::new();
let _stack_roots_tls = StackRootTLS::new(&roots);
- let (url, source) = match load_whole_resource(LoadContext::Script, &init.resource_task, worker_url, None) {
+ let (url, source) = match load_whole_resource(LoadContext::Script,
+ &init.resource_thread,
+ worker_url,
+ None) {
Err(_) => {
println!("error loading script {}", serialized_worker_url);
parent_sender.send(CommonScriptMsg::RunnableMsg(WorkerEvent,
@@ -232,7 +235,7 @@ impl DedicatedWorkerGlobalScope {
}
};
- let runtime = Rc::new(ScriptTask::new_rt_and_cx());
+ let runtime = Rc::new(ScriptThread::new_rt_and_cx());
let (devtools_mpsc_chan, devtools_mpsc_port) = channel();
ROUTER.route_ipc_receiver_to_mpsc_sender(from_devtools_receiver, devtools_mpsc_chan);
@@ -343,7 +346,7 @@ impl DedicatedWorkerGlobalScope {
let scope = self.upcast::<WorkerGlobalScope>();
let cx = scope.get_cx();
let path_seg = format!("url({})", scope.get_url());
- let reports = ScriptTask::get_reports(cx, path_seg);
+ let reports = ScriptThread::get_reports(cx, path_seg);
reports_chan.send(reports);
},
}
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index b3d747fc4d9..c4edaa7736c 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -88,8 +88,8 @@ use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl};
use net_traits::CookieSource::NonHTTP;
use net_traits::{AsyncResponseTarget, PendingAsyncLoad};
use num::ToPrimitive;
-use script_task::CSSError;
-use script_task::{MainThreadScriptMsg, Runnable};
+use script_thread::CSSError;
+use script_thread::{MainThreadScriptMsg, Runnable};
use script_traits::{ScriptMsg as ConstellationMsg, ScriptToCompositorMsg};
use script_traits::{TouchEventType, TouchId, UntrustedNodeAddress};
use std::ascii::AsciiExt;
@@ -2318,7 +2318,7 @@ impl DocumentMethods for Document {
return Err(Error::Security);
}
let (tx, rx) = ipc::channel().unwrap();
- let _ = self.window.resource_task().send(GetCookiesForUrl((*url).clone(), tx, NonHTTP));
+ let _ = self.window.resource_thread().send(GetCookiesForUrl((*url).clone(), tx, NonHTTP));
let cookies = rx.recv().unwrap();
Ok(cookies.map_or(DOMString::new(), DOMString::from))
}
@@ -2331,7 +2331,7 @@ impl DocumentMethods for Document {
return Err(Error::Security);
}
let _ = self.window
- .resource_task()
+ .resource_thread()
.send(SetCookiesForUrl((*url).clone(), String::from(cookie), NonHTTP));
Ok(())
}
diff --git a/components/script/dom/filereader.rs b/components/script/dom/filereader.rs
index 640cdca19a5..67925cb92a7 100644
--- a/components/script/dom/filereader.rs
+++ b/components/script/dom/filereader.rs
@@ -22,12 +22,12 @@ use encoding::label::encoding_from_whatwg_label;
use encoding::types::{DecoderTrap, EncodingRef};
use hyper::mime::{Attr, Mime};
use rustc_serialize::base64::{CharacterSet, Config, Newline, ToBase64};
-use script_task::ScriptTaskEventCategory::FileRead;
-use script_task::{CommonScriptMsg, Runnable, ScriptChan};
+use script_thread::ScriptThreadEventCategory::FileRead;
+use script_thread::{CommonScriptMsg, Runnable, ScriptChan};
use std::cell::Cell;
use string_cache::Atom;
use util::str::DOMString;
-use util::task::spawn_named;
+use util::thread::spawn_named;
#[derive(PartialEq, Clone, Copy, JSTraceable, HeapSizeOf)]
pub enum FileReaderFunction {
@@ -360,10 +360,10 @@ impl FileReader {
let load_data = ReadMetaData::new(String::from(type_), label.map(String::from), function);
- let fr = Trusted::new(self, global.file_reading_task_source());
+ let fr = Trusted::new(self, global.file_reading_thread_source());
let gen_id = self.generation_id.get();
- let script_chan = global.file_reading_task_source();
+ let script_chan = global.file_reading_thread_source();
spawn_named("file reader async operation".to_owned(), move || {
perform_annotated_read_operation(gen_id, load_data, blob_contents, fr, script_chan)
@@ -404,17 +404,17 @@ impl Runnable for FileReaderEvent {
}
}
-// https://w3c.github.io/FileAPI/#task-read-operation
+// https://w3c.github.io/FileAPI/#thread-read-operation
fn perform_annotated_read_operation(gen_id: GenerationId, data: ReadMetaData, blob_contents: DataSlice,
filereader: TrustedFileReader, script_chan: Box<ScriptChan + Send>) {
let chan = &script_chan;
// Step 4
- let task = box FileReaderEvent::ProcessRead(filereader.clone(), gen_id);
- chan.send(CommonScriptMsg::RunnableMsg(FileRead, task)).unwrap();
+ let thread = box FileReaderEvent::ProcessRead(filereader.clone(), gen_id);
+ chan.send(CommonScriptMsg::RunnableMsg(FileRead, thread)).unwrap();
- let task = box FileReaderEvent::ProcessReadData(filereader.clone(), gen_id);
- chan.send(CommonScriptMsg::RunnableMsg(FileRead, task)).unwrap();
+ let thread = box FileReaderEvent::ProcessReadData(filereader.clone(), gen_id);
+ chan.send(CommonScriptMsg::RunnableMsg(FileRead, thread)).unwrap();
- let task = box FileReaderEvent::ProcessReadEOF(filereader, gen_id, data, blob_contents);
- chan.send(CommonScriptMsg::RunnableMsg(FileRead, task)).unwrap();
+ let thread = box FileReaderEvent::ProcessReadEOF(filereader, gen_id, data, blob_contents);
+ chan.send(CommonScriptMsg::RunnableMsg(FileRead, thread)).unwrap();
}
diff --git a/components/script/dom/htmlcanvaselement.rs b/components/script/dom/htmlcanvaselement.rs
index b0659eb003f..e136638338d 100644
--- a/components/script/dom/htmlcanvaselement.rs
+++ b/components/script/dom/htmlcanvaselement.rs
@@ -332,11 +332,11 @@ impl<'a> From<&'a WebGLContextAttributes> for GLContextAttributes {
pub mod utils {
use dom::window::Window;
use ipc_channel::ipc;
- use net_traits::image_cache_task::{ImageCacheChan, ImageResponse};
+ use net_traits::image_cache_thread::{ImageCacheChan, ImageResponse};
use url::Url;
pub fn request_image_from_cache(window: &Window, url: Url) -> ImageResponse {
- let image_cache = window.image_cache_task();
+ let image_cache = window.image_cache_thread();
let (response_chan, response_port) = ipc::channel().unwrap();
image_cache.request_image(url, ImageCacheChan(response_chan), None);
let result = response_port.recv().unwrap();
diff --git a/components/script/dom/htmlformelement.rs b/components/script/dom/htmlformelement.rs
index e957cda4199..512a0d6a56c 100644
--- a/components/script/dom/htmlformelement.rs
+++ b/components/script/dom/htmlformelement.rs
@@ -32,7 +32,7 @@ use hyper::header::ContentType;
use hyper::method::Method;
use hyper::mime;
use msg::constellation_msg::LoadData;
-use script_task::{MainThreadScriptMsg, ScriptChan};
+use script_thread::{MainThreadScriptMsg, ScriptChan};
use std::borrow::ToOwned;
use std::cell::Cell;
use string_cache::Atom;
diff --git a/components/script/dom/htmlimageelement.rs b/components/script/dom/htmlimageelement.rs
index 39b485d6d6c..6474d360a75 100644
--- a/components/script/dom/htmlimageelement.rs
+++ b/components/script/dom/htmlimageelement.rs
@@ -22,9 +22,9 @@ use dom::virtualmethods::VirtualMethods;
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use net_traits::image::base::Image;
-use net_traits::image_cache_task::{ImageResponder, ImageResponse};
-use script_task::ScriptTaskEventCategory::UpdateReplacedElement;
-use script_task::{CommonScriptMsg, Runnable, ScriptChan};
+use net_traits::image_cache_thread::{ImageResponder, ImageResponse};
+use script_thread::ScriptThreadEventCategory::UpdateReplacedElement;
+use script_thread::{CommonScriptMsg, Runnable, ScriptChan};
use std::sync::Arc;
use string_cache::Atom;
use url::Url;
@@ -89,7 +89,7 @@ impl HTMLImageElement {
fn update_image(&self, value: Option<(DOMString, Url)>) {
let document = document_from_node(self);
let window = document.window();
- let image_cache = window.image_cache_task();
+ let image_cache = window.image_cache_thread();
match value {
None => {
*self.url.borrow_mut() = None;
@@ -101,12 +101,12 @@ impl HTMLImageElement {
let img_url = img_url.unwrap();
*self.url.borrow_mut() = Some(img_url.clone());
- let trusted_node = Trusted::new(self, window.networking_task_source());
+ let trusted_node = Trusted::new(self, window.networking_thread_source());
let (responder_sender, responder_receiver) = ipc::channel().unwrap();
- let script_chan = window.networking_task_source();
+ let script_chan = window.networking_thread_source();
let wrapper = window.get_runnable_wrapper();
ROUTER.add_route(responder_receiver.to_opaque(), box move |message| {
- // Return the image via a message to the script task, which marks the element
+ // Return the image via a message to the script thread, which marks the element
// as dirty and triggers a reflow.
let image_response = message.to().unwrap();
let runnable = ImageResponseHandlerRunnable::new(
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 58d42c57201..2738c897e6b 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -29,8 +29,8 @@ use dom::node::{document_from_node, window_from_node};
use dom::nodelist::NodeList;
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan;
-use script_task::ScriptTaskEventCategory::InputEvent;
-use script_task::{CommonScriptMsg, Runnable};
+use script_thread::ScriptThreadEventCategory::InputEvent;
+use script_thread::{CommonScriptMsg, Runnable};
use script_traits::ScriptMsg as ConstellationMsg;
use selectors::states::*;
use std::borrow::ToOwned;
@@ -937,7 +937,7 @@ impl ChangeEventRunnable {
pub fn send(node: &Node) {
let window = window_from_node(node);
let window = window.r();
- let chan = window.user_interaction_task_source();
+ let chan = window.user_interaction_thread_source();
let handler = Trusted::new(node, chan.clone());
let dispatcher = ChangeEventRunnable {
element: handler,
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index b3005be343d..58ce5dc6ea0 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -197,7 +197,7 @@ impl HTMLLinkElement {
// TODO: #8085 - Don't load external stylesheets if the node's mq doesn't match.
let doc = window.Document();
- let script_chan = window.networking_task_source();
+ let script_chan = window.networking_thread_source();
let elem = Trusted::new(self, script_chan.clone());
let context = Arc::new(Mutex::new(StylesheetContext {
diff --git a/components/script/dom/htmlscriptelement.rs b/components/script/dom/htmlscriptelement.rs
index 5db616ddf2b..ee4243874df 100644
--- a/components/script/dom/htmlscriptelement.rs
+++ b/components/script/dom/htmlscriptelement.rs
@@ -34,8 +34,8 @@ use js::jsapi::RootedValue;
use js::jsval::UndefinedValue;
use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata};
use network_listener::{NetworkListener, PreInvoke};
-use script_task::ScriptTaskEventCategory::ScriptEvent;
-use script_task::{CommonScriptMsg, Runnable, ScriptChan};
+use script_thread::ScriptThreadEventCategory::ScriptEvent;
+use script_thread::{CommonScriptMsg, Runnable, ScriptChan};
use std::ascii::AsciiExt;
use std::cell::Cell;
use std::mem;
@@ -272,7 +272,7 @@ impl HTMLScriptElement {
Ok(url) => {
// Step 14.5-7.
// TODO(#9186): use the fetch infrastructure.
- let script_chan = window.networking_task_source();
+ let script_chan = window.networking_thread_source();
let elem = Trusted::new(self, script_chan.clone());
let context = Arc::new(Mutex::new(ScriptContext {
@@ -432,7 +432,7 @@ impl HTMLScriptElement {
if external {
self.dispatch_load_event();
} else {
- let chan = window.dom_manipulation_task_source();
+ let chan = window.dom_manipulation_thread_source();
let handler = Trusted::new(self, chan.clone());
let dispatcher = box EventDispatcher {
element: handler,
@@ -445,7 +445,7 @@ impl HTMLScriptElement {
pub fn queue_error_event(&self) {
let window = window_from_node(self);
let window = window.r();
- let chan = window.dom_manipulation_task_source();
+ let chan = window.dom_manipulation_thread_source();
let handler = Trusted::new(self, chan.clone());
let dispatcher = box EventDispatcher {
element: handler,
diff --git a/components/script/dom/mod.rs b/components/script/dom/mod.rs
index 4fc7d110745..89b0745dbc3 100644
--- a/components/script/dom/mod.rs
+++ b/components/script/dom/mod.rs
@@ -35,7 +35,7 @@
//! [`MutNullableJS`](bindings/js/struct.MutNullableJS.html) and
//! [`MutHeap`](bindings/js/struct.MutHeap.html) smart pointers and
//! [the tracing implementation](bindings/trace/index.html);
-//! * rooting pointers from across task boundaries or in channels: the
+//! * rooting pointers from across thread boundaries or in channels: the
//! [`Trusted`](bindings/refcounted/struct.Trusted.html) smart pointer;
//! * extracting pointers to DOM objects from their reflectors: the
//! [`Unrooted`](bindings/js/struct.Unrooted.html) smart pointer.
@@ -196,7 +196,7 @@
//! Layout code can access the DOM through the
//! [`LayoutJS`](bindings/js/struct.LayoutJS.html) smart pointer. This does not
//! keep the DOM object alive; we ensure that no DOM code (Garbage Collection
-//! in particular) runs while the layout task is accessing the DOM.
+//! in particular) runs while the layout thread is accessing the DOM.
//!
//! Methods accessible to layout are implemented on `LayoutJS<Foo>` using
//! `LayoutFooHelpers` traits.
diff --git a/components/script/dom/node.rs b/components/script/dom/node.rs
index 76b858cf92d..e5d1367e993 100644
--- a/components/script/dom/node.rs
+++ b/components/script/dom/node.rs
@@ -64,7 +64,7 @@ use std::iter::{self, FilterMap, Peekable};
use std::mem;
use string_cache::{Atom, Namespace, QualName};
use util::str::DOMString;
-use util::task_state;
+use util::thread_state;
use uuid::Uuid;
//
@@ -113,9 +113,9 @@ pub struct Node {
/// are this node.
ranges: WeakRangeVec,
- /// Style+Layout information. Only the layout task may touch this data.
+ /// Style+Layout information. Only the layout thread may touch this data.
///
- /// Must be sent back to the layout task to be destroyed when this
+ /// Must be sent back to the layout thread to be destroyed when this
/// node is finalized.
style_and_layout_data: Cell<Option<OpaqueStyleAndLayoutData>>,
@@ -183,9 +183,9 @@ no_jsmanaged_fields!(OpaqueStyleAndLayoutData);
impl OpaqueStyleAndLayoutData {
- /// Sends the style and layout data, if any, back to the layout task to be destroyed.
+ /// Sends the style and layout data, if any, back to the layout thread to be destroyed.
pub fn dispose(self, node: &Node) {
- debug_assert!(task_state::get().is_script());
+ debug_assert!(thread_state::get().is_script());
let win = window_from_node(node);
let LayoutChan(chan) = win.layout_chan();
node.style_and_layout_data.set(None);
diff --git a/components/script/dom/servohtmlparser.rs b/components/script/dom/servohtmlparser.rs
index 26588986016..0a541fbea44 100644
--- a/components/script/dom/servohtmlparser.rs
+++ b/components/script/dom/servohtmlparser.rs
@@ -29,7 +29,7 @@ use msg::constellation_msg::{PipelineId, SubpageId};
use net_traits::{AsyncResponseListener, Metadata};
use network_listener::PreInvoke;
use parse::Parser;
-use script_task::{ScriptChan, ScriptTask};
+use script_thread::{ScriptChan, ScriptThread};
use std::cell::Cell;
use std::cell::UnsafeCell;
use std::default::Default;
@@ -241,7 +241,7 @@ impl AsyncResponseListener for ParserContext {
fn headers_available(&mut self, metadata: Metadata) {
let content_type = metadata.content_type.clone();
- let parser = ScriptTask::page_fetch_complete(self.id.clone(), self.subpage.clone(),
+ let parser = ScriptThread::page_fetch_complete(self.id.clone(), self.subpage.clone(),
metadata);
let parser = match parser {
Some(parser) => parser,
@@ -366,7 +366,7 @@ impl<'a> Parser for &'a ServoHTMLParser {
self.document.set_current_parser(None);
if let Some(pipeline) = self.pipeline {
- ScriptTask::parsing_complete(pipeline);
+ ScriptThread::parsing_complete(pipeline);
}
}
}
diff --git a/components/script/dom/servoxmlparser.rs b/components/script/dom/servoxmlparser.rs
index 1433e9f49e1..6baa7e183ff 100644
--- a/components/script/dom/servoxmlparser.rs
+++ b/components/script/dom/servoxmlparser.rs
@@ -15,7 +15,7 @@ use dom::window::Window;
use js::jsapi::JSTracer;
use msg::constellation_msg::PipelineId;
use parse::Parser;
-use script_task::ScriptTask;
+use script_thread::ScriptThread;
use std::cell::Cell;
use url::Url;
use xml5ever::tokenizer;
@@ -68,7 +68,7 @@ impl<'a> Parser for &'a ServoXMLParser {
self.document.set_current_parser(None);
if let Some(pipeline) = self.pipeline {
- ScriptTask::parsing_complete(pipeline);
+ ScriptThread::parsing_complete(pipeline);
}
}
}
diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs
index e29c5093f6c..3e2d54e6456 100644
--- a/components/script/dom/storage.rs
+++ b/components/script/dom/storage.rs
@@ -14,9 +14,9 @@ use dom::event::{Event, EventBubbles, EventCancelable};
use dom::storageevent::StorageEvent;
use dom::urlhelper::UrlHelper;
use ipc_channel::ipc;
-use net_traits::storage_task::{StorageTask, StorageTaskMsg, StorageType};
+use net_traits::storage_thread::{StorageThread, StorageThreadMsg, StorageType};
use page::IterablePage;
-use script_task::{MainThreadRunnable, MainThreadScriptMsg, ScriptTask};
+use script_thread::{MainThreadRunnable, MainThreadScriptMsg, ScriptThread};
use std::sync::mpsc::channel;
use url::Url;
use util::str::DOMString;
@@ -47,10 +47,10 @@ impl Storage {
global_ref.get_url()
}
- fn get_storage_task(&self) -> StorageTask {
+ fn get_storage_thread(&self) -> StorageThread {
let global_root = self.global.root();
let global_ref = global_root.r();
- global_ref.as_window().storage_task()
+ global_ref.as_window().storage_thread()
}
}
@@ -60,7 +60,7 @@ impl StorageMethods for Storage {
fn Length(&self) -> u32 {
let (sender, receiver) = ipc::channel().unwrap();
- self.get_storage_task().send(StorageTaskMsg::Length(sender, self.get_url(), self.storage_type)).unwrap();
+ self.get_storage_thread().send(StorageThreadMsg::Length(sender, self.get_url(), self.storage_type)).unwrap();
receiver.recv().unwrap() as u32
}
@@ -68,7 +68,9 @@ impl StorageMethods for Storage {
fn Key(&self, index: u32) -> Option<DOMString> {
let (sender, receiver) = ipc::channel().unwrap();
- self.get_storage_task().send(StorageTaskMsg::Key(sender, self.get_url(), self.storage_type, index)).unwrap();
+ self.get_storage_thread()
+ .send(StorageThreadMsg::Key(sender, self.get_url(), self.storage_type, index))
+ .unwrap();
receiver.recv().unwrap().map(DOMString::from)
}
@@ -77,8 +79,8 @@ impl StorageMethods for Storage {
let (sender, receiver) = ipc::channel().unwrap();
let name = String::from(name);
- let msg = StorageTaskMsg::GetItem(sender, self.get_url(), self.storage_type, name);
- self.get_storage_task().send(msg).unwrap();
+ let msg = StorageThreadMsg::GetItem(sender, self.get_url(), self.storage_type, name);
+ self.get_storage_thread().send(msg).unwrap();
receiver.recv().unwrap().map(DOMString::from)
}
@@ -88,8 +90,8 @@ impl StorageMethods for Storage {
let name = String::from(name);
let value = String::from(value);
- let msg = StorageTaskMsg::SetItem(sender, self.get_url(), self.storage_type, name.clone(), value.clone());
- self.get_storage_task().send(msg).unwrap();
+ let msg = StorageThreadMsg::SetItem(sender, self.get_url(), self.storage_type, name.clone(), value.clone());
+ self.get_storage_thread().send(msg).unwrap();
match receiver.recv().unwrap() {
Err(_) => Err(Error::QuotaExceeded),
Ok((changed, old_value)) => {
@@ -106,8 +108,8 @@ impl StorageMethods for Storage {
let (sender, receiver) = ipc::channel().unwrap();
let name = String::from(name);
- let msg = StorageTaskMsg::RemoveItem(sender, self.get_url(), self.storage_type, name.clone());
- self.get_storage_task().send(msg).unwrap();
+ let msg = StorageThreadMsg::RemoveItem(sender, self.get_url(), self.storage_type, name.clone());
+ self.get_storage_thread().send(msg).unwrap();
if let Some(old_value) = receiver.recv().unwrap() {
self.broadcast_change_notification(Some(name), Some(old_value), None);
}
@@ -117,7 +119,7 @@ impl StorageMethods for Storage {
fn Clear(&self) {
let (sender, receiver) = ipc::channel().unwrap();
- self.get_storage_task().send(StorageTaskMsg::Clear(sender, self.get_url(), self.storage_type)).unwrap();
+ self.get_storage_thread().send(StorageThreadMsg::Clear(sender, self.get_url(), self.storage_type)).unwrap();
if receiver.recv().unwrap() {
self.broadcast_change_notification(None, None, None);
}
@@ -127,7 +129,7 @@ impl StorageMethods for Storage {
fn SupportedPropertyNames(&self) -> Vec<DOMString> {
let (sender, receiver) = ipc::channel().unwrap();
- self.get_storage_task().send(StorageTaskMsg::Keys(sender, self.get_url(), self.storage_type)).unwrap();
+ self.get_storage_thread().send(StorageThreadMsg::Keys(sender, self.get_url(), self.storage_type)).unwrap();
receiver.recv().unwrap().iter().cloned().map(DOMString::from).collect() // FIXME: inefficient?
}
@@ -155,7 +157,7 @@ impl Storage {
let global_root = self.global.root();
let global_ref = global_root.r();
let main_script_chan = global_ref.as_window().main_thread_script_chan();
- let script_chan = global_ref.dom_manipulation_task_source();
+ let script_chan = global_ref.dom_manipulation_thread_source();
let trusted_storage = Trusted::new(self, script_chan);
main_script_chan.send(MainThreadScriptMsg::MainThreadRunnableMsg(
box StorageEventRunnable::new(trusted_storage, key, old_value, new_value))).unwrap();
@@ -177,7 +179,7 @@ impl StorageEventRunnable {
}
impl MainThreadRunnable for StorageEventRunnable {
- fn handler(self: Box<StorageEventRunnable>, script_task: &ScriptTask) {
+ fn handler(self: Box<StorageEventRunnable>, script_thread: &ScriptThread) {
let this = *self;
let storage_root = this.element.root();
let storage = storage_root.r();
@@ -195,7 +197,7 @@ impl MainThreadRunnable for StorageEventRunnable {
Some(storage)
);
- let root_page = script_task.root_page();
+ let root_page = script_thread.root_page();
for it_page in root_page.iter() {
let it_window_root = it_page.window();
let it_window = it_window_root.r();
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 6b6c310bcf0..91c5e613f35 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -31,7 +31,7 @@ use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::{JSContext, JSObject, RootedValue};
use js::jsval::{BooleanValue, DoubleValue, Int32Value, JSVal, NullValue, UndefinedValue};
use net_traits::image::base::PixelFormat;
-use net_traits::image_cache_task::ImageResponse;
+use net_traits::image_cache_thread::ImageResponse;
use offscreen_gl_context::GLContextAttributes;
use script_traits::ScriptMsg as ConstellationMsg;
use std::cell::Cell;
@@ -91,7 +91,7 @@ impl WebGLRenderingContext {
let (sender, receiver) = ipc::channel().unwrap();
let constellation_chan = global.constellation_chan();
constellation_chan.0
- .send(ConstellationMsg::CreateWebGLPaintTask(size, attrs, sender))
+ .send(ConstellationMsg::CreateWebGLPaintThread(size, attrs, sender))
.unwrap();
let result = receiver.recv().unwrap();
@@ -614,7 +614,7 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
}
// TODO(ecoal95): Probably in the future we should keep track of the
- // generated objects, either here or in the webgl task
+ // generated objects, either here or in the webgl thread
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.5
fn CreateBuffer(&self) -> Option<Root<WebGLBuffer>> {
WebGLBuffer::maybe_new(self.global.root().r(), self.ipc_renderer.clone())
diff --git a/components/script/dom/webglshader.rs b/components/script/dom/webglshader.rs
index 8046fd5f5ed..9fd35610a37 100644
--- a/components/script/dom/webglshader.rs
+++ b/components/script/dom/webglshader.rs
@@ -100,9 +100,9 @@ impl WebGLShader {
&BuiltInResources::default()).unwrap();
match validator.compile_and_translate(&[source.as_bytes()]) {
Ok(translated_source) => {
- // NOTE: At this point we should be pretty sure that the compilation in the paint task
+ // NOTE: At this point we should be pretty sure that the compilation in the paint thread
// will succeed.
- // It could be interesting to retrieve the info log from the paint task though
+ // It could be interesting to retrieve the info log from the paint thread though
let msg = CanvasWebGLMsg::CompileShader(self.id, translated_source);
self.renderer.send(CanvasMsg::WebGL(msg)).unwrap();
self.compilation_status.set(ShaderCompilationStatus::Succeeded);
diff --git a/components/script/dom/websocket.rs b/components/script/dom/websocket.rs
index 579c9466c2f..95ade2e61d7 100644
--- a/components/script/dom/websocket.rs
+++ b/components/script/dom/websocket.rs
@@ -32,8 +32,8 @@ use net_traits::hosts::replace_hosts;
use net_traits::unwrap_websocket_protocol;
use net_traits::{WebSocketCommunicate, WebSocketConnectData, WebSocketDomAction, WebSocketNetworkEvent};
use ref_slice::ref_slice;
-use script_task::ScriptTaskEventCategory::WebSocketEvent;
-use script_task::{CommonScriptMsg, Runnable};
+use script_thread::ScriptThreadEventCategory::WebSocketEvent;
+use script_thread::{CommonScriptMsg, Runnable};
use std::borrow::ToOwned;
use std::cell::Cell;
use std::ptr;
@@ -139,7 +139,7 @@ pub struct WebSocket {
global: GlobalField,
ready_state: Cell<WebSocketRequestState>,
buffered_amount: Cell<u64>,
- clearing_buffer: Cell<bool>, //Flag to tell if there is a running task to clear buffered_amount
+ clearing_buffer: Cell<bool>, //Flag to tell if there is a running thread to clear buffered_amount
#[ignore_heap_size_of = "Defined in std"]
sender: DOMRefCell<Option<IpcSender<WebSocketDomAction>>>,
failed: Cell<bool>, //Flag to tell if websocket was closed due to failure
@@ -183,7 +183,7 @@ impl WebSocket {
-> Fallible<Root<WebSocket>> {
// Step 1.
let resource_url = try!(Url::parse(&url).map_err(|_| Error::Syntax));
- // Although we do this replace and parse operation again in the resource task,
+ // Although we do this replace and parse operation again in the resource thread,
// we try here to be able to immediately throw a syntax error on failure.
let _ = try!(parse_url(&replace_hosts(&resource_url)).map_err(|_| Error::Syntax));
// Step 2: Disallow https -> ws connections.
@@ -223,7 +223,7 @@ impl WebSocket {
// Step 7.
let ws = WebSocket::new(global, resource_url.clone());
- let address = Trusted::new(ws.r(), global.networking_task_source());
+ let address = Trusted::new(ws.r(), global.networking_thread_source());
let origin = global.get_url().serialize();
let protocols: Vec<String> = protocols.iter().map(|x| String::from(x.clone())).collect();
@@ -234,7 +234,7 @@ impl WebSocket {
protocols: protocols,
};
- // Create the interface for communication with the resource task
+ // Create the interface for communication with the resource thread
let (dom_action_sender, resource_action_receiver):
(IpcSender<WebSocketDomAction>,
IpcReceiver<WebSocketDomAction>) = ipc::channel().unwrap();
@@ -247,36 +247,36 @@ impl WebSocket {
action_receiver: resource_action_receiver,
};
- let resource_task = global.resource_task();
- let _ = resource_task.send(WebsocketConnect(connect, connect_data));
+ let resource_thread = global.resource_thread();
+ let _ = resource_thread.send(WebsocketConnect(connect, connect_data));
*ws.sender.borrow_mut() = Some(dom_action_sender);
let moved_address = address.clone();
- let sender = global.networking_task_source();
+ let sender = global.networking_thread_source();
thread::spawn(move || {
while let Ok(event) = dom_event_receiver.recv() {
match event {
WebSocketNetworkEvent::ConnectionEstablished(headers, protocols) => {
- let open_task = box ConnectionEstablishedTask {
+ let open_thread = box ConnectionEstablishedTask {
addr: moved_address.clone(),
headers: headers,
protocols: protocols,
};
- sender.send(CommonScriptMsg::RunnableMsg(WebSocketEvent, open_task)).unwrap();
+ sender.send(CommonScriptMsg::RunnableMsg(WebSocketEvent, open_thread)).unwrap();
},
WebSocketNetworkEvent::MessageReceived(message) => {
- let message_task = box MessageReceivedTask {
+ let message_thread = box MessageReceivedTask {
address: moved_address.clone(),
message: message,
};
- sender.send(CommonScriptMsg::RunnableMsg(WebSocketEvent, message_task)).unwrap();
+ sender.send(CommonScriptMsg::RunnableMsg(WebSocketEvent, message_thread)).unwrap();
},
WebSocketNetworkEvent::Close => {
- let task = box CloseTask {
+ let thread = box CloseTask {
addr: moved_address.clone(),
};
- sender.send(CommonScriptMsg::RunnableMsg(WebSocketEvent, task)).unwrap();
+ sender.send(CommonScriptMsg::RunnableMsg(WebSocketEvent, thread)).unwrap();
},
}
}
@@ -296,7 +296,7 @@ impl WebSocket {
};
let global = self.global.root();
- let chan = global.r().networking_task_source();
+ let chan = global.r().networking_thread_source();
let address = Trusted::new(self, chan.clone());
match data_byte_len.checked_add(self.buffered_amount.get()) {
@@ -469,11 +469,11 @@ impl Runnable for ConnectionEstablishedTask {
if !self.protocols.is_empty() && self.headers.get::<WebSocketProtocol>().is_none() {
ws.failed.set(true);
ws.ready_state.set(WebSocketRequestState::Closing);
- let task = box CloseTask {
+ let thread = box CloseTask {
addr: self.addr,
};
- let sender = global.r().networking_task_source();
- sender.send(CommonScriptMsg::RunnableMsg(WebSocketEvent, task)).unwrap();
+ let sender = global.r().networking_thread_source();
+ sender.send(CommonScriptMsg::RunnableMsg(WebSocketEvent, thread)).unwrap();
return;
}
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index c47b9164a43..8406583ed63 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -47,17 +47,17 @@ use msg::ParseErrorReporter;
use msg::constellation_msg::{ConstellationChan, DocumentState, LoadData};
use msg::constellation_msg::{MozBrowserEvent, PipelineId, SubpageId, WindowSizeData};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
-use net_traits::ResourceTask;
-use net_traits::image_cache_task::{ImageCacheChan, ImageCacheTask};
-use net_traits::storage_task::{StorageTask, StorageType};
+use net_traits::ResourceThread;
+use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheThread};
+use net_traits::storage_thread::{StorageThread, StorageType};
use num::traits::ToPrimitive;
use page::Page;
use profile_traits::mem;
use reporter::CSSErrorReporter;
use rustc_serialize::base64::{FromBase64, STANDARD, ToBase64};
-use script_task::{DOMManipulationTaskSource, UserInteractionTaskSource, NetworkingTaskSource};
-use script_task::{HistoryTraversalTaskSource, FileReadingTaskSource, SendableMainThreadScriptChan};
-use script_task::{ScriptChan, ScriptPort, MainThreadScriptChan, MainThreadScriptMsg, RunnableWrapper};
+use script_thread::{DOMManipulationThreadSource, UserInteractionThreadSource, NetworkingThreadSource};
+use script_thread::{HistoryTraversalThreadSource, FileReadingThreadSource, SendableMainThreadScriptChan};
+use script_thread::{ScriptChan, ScriptPort, MainThreadScriptChan, MainThreadScriptMsg, RunnableWrapper};
use script_traits::ScriptMsg as ConstellationMsg;
use script_traits::{MsDuration, ScriptToCompositorMsg, TimerEvent, TimerEventId, TimerEventRequest, TimerSource};
use selectors::parser::PseudoElement;
@@ -116,21 +116,21 @@ pub struct Window {
eventtarget: EventTarget,
#[ignore_heap_size_of = "trait objects are hard"]
script_chan: MainThreadScriptChan,
- #[ignore_heap_size_of = "task sources are hard"]
- dom_manipulation_task_source: DOMManipulationTaskSource,
- #[ignore_heap_size_of = "task sources are hard"]
- user_interaction_task_source: UserInteractionTaskSource,
- #[ignore_heap_size_of = "task sources are hard"]
- networking_task_source: NetworkingTaskSource,
- #[ignore_heap_size_of = "task sources are hard"]
- history_traversal_task_source: HistoryTraversalTaskSource,
- #[ignore_heap_size_of = "task sources are hard"]
- file_reading_task_source: FileReadingTaskSource,
+ #[ignore_heap_size_of = "thread sources are hard"]
+ dom_manipulation_thread_source: DOMManipulationThreadSource,
+ #[ignore_heap_size_of = "thread sources are hard"]
+ user_interaction_thread_source: UserInteractionThreadSource,
+ #[ignore_heap_size_of = "thread sources are hard"]
+ networking_thread_source: NetworkingThreadSource,
+ #[ignore_heap_size_of = "thread sources are hard"]
+ history_traversal_thread_source: HistoryTraversalThreadSource,
+ #[ignore_heap_size_of = "thread sources are hard"]
+ file_reading_thread_source: FileReadingThreadSource,
console: MutNullableHeap<JS<Console>>,
crypto: MutNullableHeap<JS<Crypto>>,
navigator: MutNullableHeap<JS<Navigator>>,
#[ignore_heap_size_of = "channels are hard"]
- image_cache_task: ImageCacheTask,
+ image_cache_thread: ImageCacheThread,
#[ignore_heap_size_of = "channels are hard"]
image_cache_chan: ImageCacheChan,
#[ignore_heap_size_of = "TODO(#6911) newtypes containing unmeasurable types are hard"]
@@ -185,7 +185,7 @@ pub struct Window {
#[ignore_heap_size_of = "Rc<T> is hard"]
js_runtime: DOMRefCell<Option<Rc<Runtime>>>,
- /// A handle for communicating messages to the layout task.
+ /// A handle for communicating messages to the layout thread.
#[ignore_heap_size_of = "channels are hard"]
layout_chan: LayoutChan,
@@ -196,15 +196,15 @@ pub struct Window {
/// The current size of the window, in pixels.
window_size: Cell<Option<WindowSizeData>>,
- /// Associated resource task for use by DOM objects like XMLHttpRequest
+ /// Associated resource thread for use by DOM objects like XMLHttpRequest
#[ignore_heap_size_of = "channels are hard"]
- resource_task: Arc<ResourceTask>,
+ resource_thread: Arc<ResourceThread>,
- /// A handle for communicating messages to the storage task.
+ /// A handle for communicating messages to the storage thread.
#[ignore_heap_size_of = "channels are hard"]
- storage_task: StorageTask,
+ storage_thread: StorageThread,
- /// A handle for communicating messages to the constellation task.
+ /// A handle for communicating messages to the constellation thread.
#[ignore_heap_size_of = "channels are hard"]
constellation_chan: ConstellationChan<ConstellationMsg>,
@@ -249,24 +249,24 @@ impl Window {
self.js_runtime.borrow().as_ref().unwrap().cx()
}
- pub fn dom_manipulation_task_source(&self) -> Box<ScriptChan + Send> {
- self.dom_manipulation_task_source.clone()
+ pub fn dom_manipulation_thread_source(&self) -> Box<ScriptChan + Send> {
+ self.dom_manipulation_thread_source.clone()
}
- pub fn user_interaction_task_source(&self) -> Box<ScriptChan + Send> {
- self.user_interaction_task_source.clone()
+ pub fn user_interaction_thread_source(&self) -> Box<ScriptChan + Send> {
+ self.user_interaction_thread_source.clone()
}
- pub fn networking_task_source(&self) -> Box<ScriptChan + Send> {
- self.networking_task_source.clone()
+ pub fn networking_thread_source(&self) -> Box<ScriptChan + Send> {
+ self.networking_thread_source.clone()
}
- pub fn history_traversal_task_source(&self) -> Box<ScriptChan + Send> {
- self.history_traversal_task_source.clone()
+ pub fn history_traversal_thread_source(&self) -> Box<ScriptChan + Send> {
+ self.history_traversal_thread_source.clone()
}
- pub fn file_reading_task_source(&self) -> Box<ScriptChan + Send> {
- self.file_reading_task_source.clone()
+ pub fn file_reading_thread_source(&self) -> Box<ScriptChan + Send> {
+ self.file_reading_thread_source.clone()
}
pub fn main_thread_script_chan(&self) -> &Sender<MainThreadScriptMsg> {
@@ -302,8 +302,8 @@ impl Window {
(box SendableMainThreadScriptChan(tx), box rx)
}
- pub fn image_cache_task(&self) -> &ImageCacheTask {
- &self.image_cache_task
+ pub fn image_cache_thread(&self) -> &ImageCacheThread {
+ &self.image_cache_thread
}
pub fn compositor(&self) -> &IpcSender<ScriptToCompositorMsg> {
@@ -318,8 +318,8 @@ impl Window {
&*self.page
}
- pub fn storage_task(&self) -> StorageTask {
- self.storage_task.clone()
+ pub fn storage_thread(&self) -> StorageThread {
+ self.storage_thread.clone()
}
pub fn css_error_reporter(&self) -> Box<ParseErrorReporter + Send> {
@@ -837,10 +837,10 @@ impl Window {
// (e.g. DOM objects removed from the tree that haven't
// been collected yet). Forcing a GC here means that
// those DOM objects will be able to call dispose()
- // to free their layout data before the layout task
+ // to free their layout data before the layout thread
// exits. Without this, those remaining objects try to
// send a message to free their layout data to the
- // layout task when the script task is dropped,
+ // layout thread when the script thread is dropped,
// which causes a panic!
self.Gc();
@@ -981,7 +981,7 @@ impl Window {
}
Ok(_) => {}
Err(Disconnected) => {
- panic!("Layout task failed while script was waiting for a result.");
+ panic!("Layout thread failed while script was waiting for a result.");
}
}
@@ -1018,7 +1018,7 @@ impl Window {
// 2) The html element doesn't contain the 'reftest-wait' class
// 3) The load event has fired.
// When all these conditions are met, notify the constellation
- // that this pipeline is ready to write the image (from the script task
+ // that this pipeline is ready to write the image (from the script thread
// perspective at least).
if opts::get().output_file.is_some() && for_display {
let document = self.Document();
@@ -1126,8 +1126,8 @@ impl Window {
(*self.Document().url()).clone()
}
- pub fn resource_task(&self) -> ResourceTask {
- (*self.resource_task).clone()
+ pub fn resource_thread(&self) -> ResourceThread {
+ (*self.resource_thread).clone()
}
pub fn mem_profiler_chan(&self) -> mem::ProfilerChan {
@@ -1288,16 +1288,16 @@ impl Window {
pub fn new(runtime: Rc<Runtime>,
page: Rc<Page>,
script_chan: MainThreadScriptChan,
- dom_task_source: DOMManipulationTaskSource,
- user_task_source: UserInteractionTaskSource,
- network_task_source: NetworkingTaskSource,
- history_task_source: HistoryTraversalTaskSource,
- file_task_source: FileReadingTaskSource,
+ dom_thread_source: DOMManipulationThreadSource,
+ user_thread_source: UserInteractionThreadSource,
+ network_thread_source: NetworkingThreadSource,
+ history_thread_source: HistoryTraversalThreadSource,
+ file_thread_source: FileReadingThreadSource,
image_cache_chan: ImageCacheChan,
compositor: IpcSender<ScriptToCompositorMsg>,
- image_cache_task: ImageCacheTask,
- resource_task: Arc<ResourceTask>,
- storage_task: StorageTask,
+ image_cache_thread: ImageCacheThread,
+ resource_thread: Arc<ResourceThread>,
+ storage_thread: StorageThread,
mem_profiler_chan: mem::ProfilerChan,
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
constellation_chan: ConstellationChan<ConstellationMsg>,
@@ -1318,18 +1318,18 @@ impl Window {
let win = box Window {
eventtarget: EventTarget::new_inherited(),
script_chan: script_chan,
- dom_manipulation_task_source: dom_task_source,
- user_interaction_task_source: user_task_source,
- networking_task_source: network_task_source,
- history_traversal_task_source: history_task_source,
- file_reading_task_source: file_task_source,
+ dom_manipulation_thread_source: dom_thread_source,
+ user_interaction_thread_source: user_thread_source,
+ networking_thread_source: network_thread_source,
+ history_traversal_thread_source: history_thread_source,
+ file_reading_thread_source: file_thread_source,
image_cache_chan: image_cache_chan,
console: Default::default(),
crypto: Default::default(),
compositor: compositor,
page: page,
navigator: Default::default(),
- image_cache_task: image_cache_task,
+ image_cache_thread: image_cache_thread,
mem_profiler_chan: mem_profiler_chan,
devtools_chan: devtools_chan,
browsing_context: Default::default(),
@@ -1346,8 +1346,8 @@ impl Window {
parent_info: parent_info,
dom_static: GlobalStaticData::new(),
js_runtime: DOMRefCell::new(Some(runtime.clone())),
- resource_task: resource_task,
- storage_task: storage_task,
+ resource_thread: resource_thread,
+ storage_thread: storage_thread,
constellation_chan: constellation_chan,
page_clip_rect: Cell::new(MAX_RECT),
fragment_name: DOMRefCell::new(None),
diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs
index 5ca3d3316fc..362874643bc 100644
--- a/components/script/dom/worker.rs
+++ b/components/script/dom/worker.rs
@@ -24,7 +24,7 @@ use ipc_channel::ipc;
use js::jsapi::{HandleValue, JSContext, RootedValue};
use js::jsapi::{JSAutoCompartment, JSAutoRequest};
use js::jsval::UndefinedValue;
-use script_task::{Runnable, ScriptChan};
+use script_thread::{Runnable, ScriptChan};
use std::sync::mpsc::{Sender, channel};
use util::str::DOMString;
@@ -68,13 +68,13 @@ impl Worker {
Err(_) => return Err(Error::Syntax),
};
- let resource_task = global.resource_task();
+ let resource_thread = global.resource_thread();
let constellation_chan = global.constellation_chan();
let scheduler_chan = global.scheduler_chan();
let (sender, receiver) = channel();
let worker = Worker::new(global, sender.clone());
- let worker_ref = Trusted::new(worker.r(), global.dom_manipulation_task_source());
+ let worker_ref = Trusted::new(worker.r(), global.dom_manipulation_thread_source());
let worker_id = global.get_next_worker_id();
let (devtools_sender, devtools_receiver) = ipc::channel().unwrap();
@@ -95,7 +95,7 @@ impl Worker {
};
let init = WorkerGlobalScopeInit {
- resource_task: resource_task,
+ resource_thread: resource_thread,
mem_profiler_chan: global.mem_profiler_chan(),
to_devtools_sender: global.devtools_chan(),
from_devtools_sender: optional_sender,
@@ -105,7 +105,7 @@ impl Worker {
};
DedicatedWorkerGlobalScope::run_worker_scope(
init, worker_url, global.pipeline(), devtools_receiver, worker_ref,
- global.dom_manipulation_task_source(), sender, receiver);
+ global.dom_manipulation_thread_source(), sender, receiver);
Ok(worker)
}
@@ -145,7 +145,7 @@ impl WorkerMethods for Worker {
// https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage
fn PostMessage(&self, cx: *mut JSContext, message: HandleValue) -> ErrorResult {
let data = try!(StructuredCloneData::write(cx, message));
- let address = Trusted::new(self, self.global.root().r().dom_manipulation_task_source());
+ let address = Trusted::new(self, self.global.root().r().dom_manipulation_thread_source());
self.sender.send((address, WorkerScriptMsg::DOMMessage(data))).unwrap();
Ok(())
}
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index 3224c04d57f..360c78099dd 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -21,9 +21,9 @@ use ipc_channel::ipc::IpcSender;
use js::jsapi::{HandleValue, JSAutoRequest, JSContext};
use js::rust::Runtime;
use msg::constellation_msg::{ConstellationChan, PipelineId};
-use net_traits::{LoadContext, ResourceTask, load_whole_resource};
+use net_traits::{LoadContext, ResourceThread, load_whole_resource};
use profile_traits::mem;
-use script_task::{CommonScriptMsg, ScriptChan, ScriptPort};
+use script_thread::{CommonScriptMsg, ScriptChan, ScriptPort};
use script_traits::ScriptMsg as ConstellationMsg;
use script_traits::{MsDuration, TimerEvent, TimerEventId, TimerEventRequest, TimerSource};
use std::cell::Cell;
@@ -40,7 +40,7 @@ pub enum WorkerGlobalScopeTypeId {
}
pub struct WorkerGlobalScopeInit {
- pub resource_task: ResourceTask,
+ pub resource_thread: ResourceThread,
pub mem_profiler_chan: mem::ProfilerChan,
pub to_devtools_sender: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
pub from_devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>,
@@ -59,7 +59,7 @@ pub struct WorkerGlobalScope {
runtime: Rc<Runtime>,
next_worker_id: Cell<WorkerId>,
#[ignore_heap_size_of = "Defined in std"]
- resource_task: ResourceTask,
+ resource_thread: ResourceThread,
location: MutNullableHeap<JS<WorkerLocation>>,
navigator: MutNullableHeap<JS<WorkerNavigator>>,
console: MutNullableHeap<JS<Console>>,
@@ -104,7 +104,7 @@ impl WorkerGlobalScope {
worker_id: init.worker_id,
worker_url: worker_url,
runtime: runtime,
- resource_task: init.resource_task,
+ resource_thread: init.resource_thread,
location: Default::default(),
navigator: Default::default(),
console: Default::default(),
@@ -158,8 +158,8 @@ impl WorkerGlobalScope {
self.runtime.cx()
}
- pub fn resource_task(&self) -> &ResourceTask {
- &self.resource_task
+ pub fn resource_thread(&self) -> &ResourceThread {
+ &self.resource_thread
}
pub fn get_url(&self) -> &Url {
@@ -203,7 +203,7 @@ impl WorkerGlobalScopeMethods for WorkerGlobalScope {
}
for url in urls {
- let (url, source) = match load_whole_resource(LoadContext::Script, &self.resource_task, url, None) {
+ let (url, source) = match load_whole_resource(LoadContext::Script, &self.resource_thread, url, None) {
Err(_) => return Err(Error::Network),
Ok((metadata, bytes)) => {
(metadata.final_url, String::from_utf8(bytes).unwrap())
diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs
index cac963c85d9..854c9887d30 100644
--- a/components/script/dom/xmlhttprequest.rs
+++ b/components/script/dom/xmlhttprequest.rs
@@ -46,11 +46,11 @@ use js::jsapi::{JSContext, JS_ParseJSON, RootedValue};
use js::jsval::{JSVal, NullValue, UndefinedValue};
use net_traits::ControlMsg::Load;
use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata};
-use net_traits::{LoadConsumer, LoadContext, LoadData, ResourceCORSData, ResourceTask};
+use net_traits::{LoadConsumer, LoadContext, LoadData, ResourceCORSData, ResourceThread};
use network_listener::{NetworkListener, PreInvoke};
use parse::html::{ParseContext, parse_html};
use parse::xml::{self, parse_xml};
-use script_task::{ScriptChan, ScriptPort};
+use script_thread::{ScriptChan, ScriptPort};
use std::ascii::AsciiExt;
use std::borrow::ToOwned;
use std::cell::{Cell, RefCell};
@@ -197,13 +197,13 @@ impl XMLHttpRequest {
load_data: LoadData,
req: CORSRequest,
script_chan: Box<ScriptChan + Send>,
- resource_task: ResourceTask) {
+ resource_thread: ResourceThread) {
struct CORSContext {
xhr: Arc<Mutex<XHRContext>>,
load_data: RefCell<Option<LoadData>>,
req: CORSRequest,
script_chan: Box<ScriptChan + Send>,
- resource_task: ResourceTask,
+ resource_thread: ResourceThread,
}
impl AsyncCORSResponseListener for CORSContext {
@@ -223,7 +223,7 @@ impl XMLHttpRequest {
});
XMLHttpRequest::initiate_async_xhr(self.xhr.clone(), self.script_chan.clone(),
- self.resource_task.clone(), load_data);
+ self.resource_thread.clone(), load_data);
}
}
@@ -232,7 +232,7 @@ impl XMLHttpRequest {
load_data: RefCell::new(Some(load_data)),
req: req.clone(),
script_chan: script_chan.clone(),
- resource_task: resource_task,
+ resource_thread: resource_thread,
};
req.http_fetch_async(box cors_context, script_chan);
@@ -240,7 +240,7 @@ impl XMLHttpRequest {
fn initiate_async_xhr(context: Arc<Mutex<XHRContext>>,
script_chan: Box<ScriptChan + Send>,
- resource_task: ResourceTask,
+ resource_thread: ResourceThread,
load_data: LoadData) {
impl AsyncResponseListener for XHRContext {
fn headers_available(&mut self, metadata: Metadata) {
@@ -281,7 +281,7 @@ impl XMLHttpRequest {
ROUTER.add_route(action_receiver.to_opaque(), box move |message| {
listener.notify(message.to().unwrap());
});
- resource_task.send(Load(load_data, LoadConsumer::Listener(response_target), None)).unwrap();
+ resource_thread.send(Load(load_data, LoadConsumer::Listener(response_target), None)).unwrap();
}
}
@@ -1026,7 +1026,7 @@ impl XMLHttpRequest {
// This will cancel all previous timeouts
let global = self.global.root();
let callback = ScheduledXHRTimeout {
- xhr: Trusted::new(self, global.r().networking_task_source()),
+ xhr: Trusted::new(self, global.r().networking_thread_source()),
generation_id: self.generation_id.get(),
};
let duration = Length::new(duration_ms as u64);
@@ -1178,7 +1178,7 @@ impl XMLHttpRequest {
Ok(req) => req,
};
- let xhr = Trusted::new(self, global.networking_task_source());
+ let xhr = Trusted::new(self, global.networking_thread_source());
let context = Arc::new(Mutex::new(XHRContext {
xhr: xhr,
@@ -1192,16 +1192,16 @@ impl XMLHttpRequest {
let (tx, rx) = global.new_script_pair();
(tx, Some(rx))
} else {
- (global.networking_task_source(), None)
+ (global.networking_thread_source(), None)
};
- let resource_task = global.resource_task();
+ let resource_thread = global.resource_thread();
if let Some(req) = cors_request {
XMLHttpRequest::check_cors(context.clone(), load_data, req.clone(),
- script_chan.clone(), resource_task);
+ script_chan.clone(), resource_thread);
} else {
XMLHttpRequest::initiate_async_xhr(context.clone(), script_chan,
- resource_task, load_data);
+ resource_thread, load_data);
}
if let Some(script_port) = script_port {
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs
index 5f6fd653a7e..9d407c4e8b2 100644
--- a/components/script/layout_interface.rs
+++ b/components/script/layout_interface.rs
@@ -15,7 +15,7 @@ use ipc_channel::ipc::{IpcReceiver, IpcSender};
use msg::compositor_msg::Epoch;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use msg::constellation_msg::{WindowSizeData};
-use net_traits::image_cache_task::ImageCacheTask;
+use net_traits::image_cache_thread::ImageCacheThread;
use profile_traits::mem::ReportsChan;
use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg};
use script_traits::{OpaqueScriptLayoutChannel, UntrustedNodeAddress};
@@ -46,10 +46,10 @@ pub enum Msg {
/// Get an RPC interface.
GetRPC(Sender<Box<LayoutRPC + Send>>),
- /// Requests that the layout task render the next frame of all animations.
+ /// Requests that the layout thread render the next frame of all animations.
TickAnimations,
- /// Requests that the layout task reflow with a newly-loaded Web font.
+ /// Requests that the layout thread reflow with a newly-loaded Web font.
ReflowWithNewlyLoadedWebFont,
/// Updates the layout visible rects, affecting the area that display lists will be constructed
@@ -61,30 +61,30 @@ pub enum Msg {
/// TODO(pcwalton): Maybe think about batching to avoid message traffic.
ReapStyleAndLayoutData(OpaqueStyleAndLayoutData),
- /// Requests that the layout task measure its memory usage. The resulting reports are sent back
+ /// Requests that the layout thread measure its memory usage. The resulting reports are sent back
/// via the supplied channel.
CollectReports(ReportsChan),
- /// Requests that the layout task enter a quiescent state in which no more messages are
+ /// Requests that the layout thread enter a quiescent state in which no more messages are
/// accepted except `ExitMsg`. A response message will be sent on the supplied channel when
/// this happens.
PrepareToExit(Sender<()>),
- /// Requests that the layout task immediately shut down. There must be no more nodes left after
+ /// Requests that the layout thread immediately shut down. There must be no more nodes left after
/// this, or layout will crash.
ExitNow,
- /// Get the last epoch counter for this layout task.
+ /// Get the last epoch counter for this layout thread.
GetCurrentEpoch(IpcSender<Epoch>),
- /// Asks the layout task whether any Web fonts have yet to load (if true, loads are pending;
+ /// Asks the layout thread whether any Web fonts have yet to load (if true, loads are pending;
/// false otherwise).
GetWebFontLoadState(IpcSender<bool>),
- /// Creates a new layout task.
+ /// Creates a new layout thread.
///
/// This basically exists to keep the script-layout dependency one-way.
- CreateLayoutTask(NewLayoutTaskInfo),
+ CreateLayoutThread(NewLayoutThreadInfo),
/// Set the final Url.
SetFinalUrl(Url),
@@ -95,7 +95,7 @@ pub enum Msg {
/// In general, you should use messages to talk to Layout. Use the RPC interface
/// if and only if the work is
///
-/// 1) read-only with respect to LayoutTaskData,
+/// 1) read-only with respect to LayoutThreadData,
/// 2) small,
/// 3) and really needs to be fast.
pub trait LayoutRPC {
@@ -181,7 +181,7 @@ impl Drop for ScriptReflow {
}
}
-/// Encapsulates a channel to the layout task.
+/// Encapsulates a channel to the layout thread.
#[derive(Clone)]
pub struct LayoutChan(pub Sender<Msg>);
@@ -217,7 +217,7 @@ impl ScriptLayoutChan for OpaqueScriptLayoutChannel {
}
}
-pub struct NewLayoutTaskInfo {
+pub struct NewLayoutThreadInfo {
pub id: PipelineId,
pub url: Url,
pub is_parent: bool,
@@ -226,7 +226,7 @@ pub struct NewLayoutTaskInfo {
pub constellation_chan: ConstellationChan<ConstellationMsg>,
pub failure: Failure,
pub script_chan: IpcSender<ConstellationControlMsg>,
- pub image_cache_task: ImageCacheTask,
+ pub image_cache_thread: ImageCacheThread,
pub paint_chan: OptionalOpaqueIpcSender,
pub layout_shutdown_chan: IpcSender<()>,
pub content_process_shutdown_chan: IpcSender<()>,
diff --git a/components/script/lib.rs b/components/script/lib.rs
index 71afdb02df4..24483d3182f 100644
--- a/components/script/lib.rs
+++ b/components/script/lib.rs
@@ -92,7 +92,7 @@ pub mod page;
pub mod parse;
pub mod reporter;
#[allow(unsafe_code)]
-pub mod script_task;
+pub mod script_thread;
pub mod textinput;
mod timers;
mod unpremultiplytable;
@@ -147,7 +147,7 @@ fn perform_platform_specific_initialization() {}
pub fn init() {
unsafe {
assert_eq!(js::jsapi::JS_Init(), true);
- SetDOMProxyInformation(ptr::null(), 0, Some(script_task::shadow_check_callback));
+ SetDOMProxyInformation(ptr::null(), 0, Some(script_thread::shadow_check_callback));
}
// Create the global vtables used by the (generated) DOM
diff --git a/components/script/network_listener.rs b/components/script/network_listener.rs
index d16517230bc..448befa0f51 100644
--- a/components/script/network_listener.rs
+++ b/components/script/network_listener.rs
@@ -3,8 +3,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use net_traits::{AsyncResponseListener, ResponseAction};
-use script_task::ScriptTaskEventCategory::NetworkEvent;
-use script_task::{CommonScriptMsg, Runnable, ScriptChan};
+use script_thread::ScriptThreadEventCategory::NetworkEvent;
+use script_thread::{CommonScriptMsg, Runnable, ScriptChan};
use std::sync::{Arc, Mutex};
/// An off-thread sink for async network event runnables. All such events are forwarded to
diff --git a/components/script/script_task.rs b/components/script/script_thread.rs
index 910d1e785f8..f0ed7ac22d6 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_thread.rs
@@ -2,19 +2,19 @@
* 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/. */
-//! The script task is the task that owns the DOM in memory, runs JavaScript, and spawns parsing
-//! and layout tasks. It's in charge of processing events for all same-origin pages in a frame
+//! The script thread is the thread that owns the DOM in memory, runs JavaScript, and spawns parsing
+//! and layout threads. It's in charge of processing events for all same-origin pages in a frame
//! tree, and manages the entire lifetime of pages in the frame tree from initial request to
//! teardown.
//!
//! Page loads follow a two-step process. When a request for a new page load is received, the
//! network request is initiated and the relevant data pertaining to the new page is stashed.
-//! While the non-blocking request is ongoing, the script task is free to process further events,
+//! While the non-blocking request is ongoing, the script thread is free to process further events,
//! noting when they pertain to ongoing loads (such as resizes/viewport adjustments). When the
//! initial response is received for an ongoing load, the second phase starts - the frame tree
//! entry is created, along with the Window and Document objects, and the appropriate parser
//! takes over the response body. Once parsing is complete, the document lifecycle for loading
-//! a page runs its course and the script task returns to processing events in the main event
+//! a page runs its course and the script thread returns to processing events in the main event
//! loop.
use devtools;
@@ -59,7 +59,7 @@ use js::jsapi::{JSObject, SetPreserveWrapperCallback};
use js::jsval::UndefinedValue;
use js::rust::Runtime;
use layout_interface::{ReflowQueryType};
-use layout_interface::{self, LayoutChan, NewLayoutTaskInfo, ReflowGoal, ScriptLayoutChan};
+use layout_interface::{self, LayoutChan, NewLayoutThreadInfo, ReflowGoal, ScriptLayoutChan};
use libc;
use mem::heap_size_of_self_and_children;
use msg::constellation_msg::{ConstellationChan, LoadData};
@@ -68,9 +68,9 @@ use msg::constellation_msg::{PipelineNamespace};
use msg::constellation_msg::{SubpageId, WindowSizeData};
use msg::webdriver_msg::WebDriverScriptCommand;
use net_traits::LoadData as NetLoadData;
-use net_traits::image_cache_task::{ImageCacheChan, ImageCacheResult, ImageCacheTask};
-use net_traits::storage_task::StorageTask;
-use net_traits::{AsyncResponseTarget, ControlMsg, LoadConsumer, LoadContext, Metadata, ResourceTask};
+use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
+use net_traits::storage_thread::StorageThread;
+use net_traits::{AsyncResponseTarget, ControlMsg, LoadConsumer, LoadContext, Metadata, ResourceThread};
use network_listener::NetworkListener;
use page::{Frame, IterablePage, Page};
use parse::html::{ParseContext, parse_html};
@@ -81,7 +81,7 @@ use script_traits::CompositorEvent::{KeyEvent, MouseButtonEvent, MouseMoveEvent,
use script_traits::CompositorEvent::{TouchEvent};
use script_traits::{CompositorEvent, ConstellationControlMsg, EventResult, InitialScriptState, NewLayoutInfo};
use script_traits::{LayoutMsg, OpaqueScriptLayoutChannel, ScriptMsg as ConstellationMsg};
-use script_traits::{ScriptTaskFactory, ScriptToCompositorMsg, TimerEvent, TimerEventRequest, TimerSource};
+use script_traits::{ScriptThreadFactory, ScriptToCompositorMsg, TimerEvent, TimerEventRequest, TimerSource};
use script_traits::{TouchEventType, TouchId};
use std::any::Any;
use std::borrow::ToOwned;
@@ -101,17 +101,17 @@ use time::{Tm, now};
use url::Url;
use util::opts;
use util::str::DOMString;
-use util::task;
-use util::task_state;
+use util::thread;
+use util::thread_state;
use webdriver_handlers;
thread_local!(pub static STACK_ROOTS: Cell<Option<RootCollectionPtr>> = Cell::new(None));
-thread_local!(static SCRIPT_TASK_ROOT: RefCell<Option<*const ScriptTask>> = RefCell::new(None));
+thread_local!(static SCRIPT_TASK_ROOT: RefCell<Option<*const ScriptThread>> = RefCell::new(None));
unsafe extern fn trace_rust_roots(tr: *mut JSTracer, _data: *mut libc::c_void) {
SCRIPT_TASK_ROOT.with(|root| {
- if let Some(script_task) = *root.borrow() {
- (*script_task).trace(tr);
+ if let Some(script_thread) = *root.borrow() {
+ (*script_thread).trace(tr);
}
});
@@ -131,7 +131,7 @@ struct InProgressLoad {
parent_info: Option<(PipelineId, SubpageId)>,
/// The current window size associated with this pipeline.
window_size: Option<WindowSizeData>,
- /// Channel to the layout task associated with this pipeline.
+ /// Channel to the layout thread associated with this pipeline.
layout_chan: LayoutChan,
/// The current viewport clipping rectangle applying to this pipeline, if any.
clip_rect: Option<Rect<f32>>,
@@ -196,7 +196,7 @@ pub trait Runnable {
}
pub trait MainThreadRunnable {
- fn handler(self: Box<Self>, script_task: &ScriptTask);
+ fn handler(self: Box<Self>, script_thread: &ScriptThread);
}
enum MixedMessage {
@@ -209,17 +209,17 @@ enum MixedMessage {
/// Common messages used to control the event loops in both the script and the worker
pub enum CommonScriptMsg {
- /// Requests that the script task measure its memory usage. The results are sent back via the
+ /// Requests that the script thread measure its memory usage. The results are sent back via the
/// supplied channel.
CollectReports(ReportsChan),
- /// A DOM object's last pinned reference was removed (dispatched to all tasks).
+ /// A DOM object's last pinned reference was removed (dispatched to all threads).
RefcountCleanup(TrustedReference),
/// Generic message that encapsulates event handling.
- RunnableMsg(ScriptTaskEventCategory, Box<Runnable + Send>),
+ RunnableMsg(ScriptThreadEventCategory, Box<Runnable + Send>),
}
#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, PartialEq)]
-pub enum ScriptTaskEventCategory {
+pub enum ScriptThreadEventCategory {
AttachLayout,
ConstellationMsg,
DevtoolsMsg,
@@ -246,12 +246,12 @@ pub enum MainThreadScriptMsg {
/// Notify a document that all pending loads are complete.
DocumentLoadsComplete(PipelineId),
/// Notifies the script that a window associated with a particular pipeline
- /// should be closed (only dispatched to ScriptTask).
+ /// should be closed (only dispatched to ScriptThread).
ExitWindow(PipelineId),
- /// Generic message for running tasks in the ScriptTask
+ /// Generic message for running threads in the ScriptThread
MainThreadRunnableMsg(Box<MainThreadRunnable + Send>),
/// Begins a content-initiated load on the specified pipeline (only
- /// dispatched to ScriptTask).
+ /// dispatched to ScriptThread).
Navigate(PipelineId, LoadData),
}
@@ -306,7 +306,7 @@ impl ScriptPort for Receiver<(TrustedWorkerAddress, MainThreadScriptMsg)> {
}
}
-/// Encapsulates internal communication of shared messages within the script task.
+/// Encapsulates internal communication of shared messages within the script thread.
#[derive(JSTraceable)]
pub struct SendableMainThreadScriptChan(pub Sender<CommonScriptMsg>);
@@ -330,7 +330,7 @@ impl SendableMainThreadScriptChan {
}
}
-/// Encapsulates internal communication of main thread messages within the script task.
+/// Encapsulates internal communication of main thread messages within the script thread.
#[derive(JSTraceable)]
pub struct MainThreadScriptChan(pub Sender<MainThreadScriptMsg>);
@@ -354,99 +354,99 @@ impl MainThreadScriptChan {
}
}
-// FIXME: Use a task source specific message instead of MainThreadScriptMsg
+// FIXME: Use a thread source specific message instead of MainThreadScriptMsg
#[derive(JSTraceable)]
-pub struct DOMManipulationTaskSource(pub Sender<MainThreadScriptMsg>);
+pub struct DOMManipulationThreadSource(pub Sender<MainThreadScriptMsg>);
-impl ScriptChan for DOMManipulationTaskSource {
+impl ScriptChan for DOMManipulationThreadSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let DOMManipulationTaskSource(ref chan) = *self;
+ let DOMManipulationThreadSource(ref chan) = *self;
chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let DOMManipulationTaskSource(ref chan) = *self;
- box DOMManipulationTaskSource((*chan).clone())
+ let DOMManipulationThreadSource(ref chan) = *self;
+ box DOMManipulationThreadSource((*chan).clone())
}
}
-// FIXME: Use a task source specific message instead of MainThreadScriptMsg
+// FIXME: Use a thread source specific message instead of MainThreadScriptMsg
#[derive(JSTraceable)]
-pub struct UserInteractionTaskSource(pub Sender<MainThreadScriptMsg>);
+pub struct UserInteractionThreadSource(pub Sender<MainThreadScriptMsg>);
-impl ScriptChan for UserInteractionTaskSource {
+impl ScriptChan for UserInteractionThreadSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let UserInteractionTaskSource(ref chan) = *self;
+ let UserInteractionThreadSource(ref chan) = *self;
chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let UserInteractionTaskSource(ref chan) = *self;
- box UserInteractionTaskSource((*chan).clone())
+ let UserInteractionThreadSource(ref chan) = *self;
+ box UserInteractionThreadSource((*chan).clone())
}
}
-// FIXME: Use a task source specific message instead of MainThreadScriptMsg
+// FIXME: Use a thread source specific message instead of MainThreadScriptMsg
#[derive(JSTraceable)]
-pub struct NetworkingTaskSource(pub Sender<MainThreadScriptMsg>);
+pub struct NetworkingThreadSource(pub Sender<MainThreadScriptMsg>);
-impl ScriptChan for NetworkingTaskSource {
+impl ScriptChan for NetworkingThreadSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let NetworkingTaskSource(ref chan) = *self;
+ let NetworkingThreadSource(ref chan) = *self;
chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let NetworkingTaskSource(ref chan) = *self;
- box NetworkingTaskSource((*chan).clone())
+ let NetworkingThreadSource(ref chan) = *self;
+ box NetworkingThreadSource((*chan).clone())
}
}
-// FIXME: Use a task source specific message instead of MainThreadScriptMsg
+// FIXME: Use a thread source specific message instead of MainThreadScriptMsg
#[derive(JSTraceable)]
-pub struct HistoryTraversalTaskSource(pub Sender<MainThreadScriptMsg>);
+pub struct HistoryTraversalThreadSource(pub Sender<MainThreadScriptMsg>);
-impl ScriptChan for HistoryTraversalTaskSource {
+impl ScriptChan for HistoryTraversalThreadSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let HistoryTraversalTaskSource(ref chan) = *self;
+ let HistoryTraversalThreadSource(ref chan) = *self;
chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let HistoryTraversalTaskSource(ref chan) = *self;
- box HistoryTraversalTaskSource((*chan).clone())
+ let HistoryTraversalThreadSource(ref chan) = *self;
+ box HistoryTraversalThreadSource((*chan).clone())
}
}
-// FIXME: Use a task source specific message instead of MainThreadScriptMsg
+// FIXME: Use a thread source specific message instead of MainThreadScriptMsg
#[derive(JSTraceable)]
-pub struct FileReadingTaskSource(pub Sender<MainThreadScriptMsg>);
+pub struct FileReadingThreadSource(pub Sender<MainThreadScriptMsg>);
-impl ScriptChan for FileReadingTaskSource {
+impl ScriptChan for FileReadingThreadSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let FileReadingTaskSource(ref chan) = *self;
+ let FileReadingThreadSource(ref chan) = *self;
chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let FileReadingTaskSource(ref chan) = *self;
- box FileReadingTaskSource((*chan).clone())
+ let FileReadingThreadSource(ref chan) = *self;
+ box FileReadingThreadSource((*chan).clone())
}
}
-// FIXME: Use a task source specific message instead of MainThreadScriptMsg
+// FIXME: Use a thread source specific message instead of MainThreadScriptMsg
#[derive(JSTraceable)]
-pub struct ProfilerTaskSource(pub Sender<MainThreadScriptMsg>);
+pub struct ProfilerThreadSource(pub Sender<MainThreadScriptMsg>);
-impl ScriptChan for ProfilerTaskSource {
+impl ScriptChan for ProfilerThreadSource {
fn send(&self, msg: CommonScriptMsg) -> Result<(), ()> {
- let ProfilerTaskSource(ref chan) = *self;
+ let ProfilerThreadSource(ref chan) = *self;
chan.send(MainThreadScriptMsg::Common(msg)).map_err(|_| ())
}
fn clone(&self) -> Box<ScriptChan + Send> {
- let ProfilerTaskSource(ref chan) = *self;
- box ProfilerTaskSource((*chan).clone())
+ let ProfilerThreadSource(ref chan) = *self;
+ box ProfilerThreadSource((*chan).clone())
}
}
@@ -471,41 +471,41 @@ impl<'a> Drop for StackRootTLS<'a> {
/// Information for an entire page. Pages are top-level browsing contexts and can contain multiple
/// frames.
#[derive(JSTraceable)]
-// ScriptTask instances are rooted on creation, so this is okay
+// ScriptThread instances are rooted on creation, so this is okay
#[allow(unrooted_must_root)]
-pub struct ScriptTask {
+pub struct ScriptThread {
/// A handle to the information pertaining to page layout
page: DOMRefCell<Option<Rc<Page>>>,
/// A list of data pertaining to loads that have not yet received a network response
incomplete_loads: DOMRefCell<Vec<InProgressLoad>>,
- /// A handle to the image cache task.
- image_cache_task: ImageCacheTask,
- /// A handle to the resource task. This is an `Arc` to avoid running out of file descriptors if
+ /// A handle to the image cache thread.
+ image_cache_thread: ImageCacheThread,
+ /// A handle to the resource thread. This is an `Arc` to avoid running out of file descriptors if
/// there are many iframes.
- resource_task: Arc<ResourceTask>,
- /// A handle to the storage task.
- storage_task: StorageTask,
+ resource_thread: Arc<ResourceThread>,
+ /// A handle to the storage thread.
+ storage_thread: StorageThread,
- /// The port on which the script task receives messages (load URL, exit, etc.)
+ /// The port on which the script thread receives messages (load URL, exit, etc.)
port: Receiver<MainThreadScriptMsg>,
- /// A channel to hand out to script task-based entities that need to be able to enqueue
+ /// A channel to hand out to script thread-based entities that need to be able to enqueue
/// events in the event queue.
chan: MainThreadScriptChan,
- dom_manipulation_task_source: DOMManipulationTaskSource,
+ dom_manipulation_thread_source: DOMManipulationThreadSource,
- user_interaction_task_source: UserInteractionTaskSource,
+ user_interaction_thread_source: UserInteractionThreadSource,
- networking_task_source: NetworkingTaskSource,
+ networking_thread_source: NetworkingThreadSource,
- history_traversal_task_source: HistoryTraversalTaskSource,
+ history_traversal_thread_source: HistoryTraversalThreadSource,
- file_reading_task_source: FileReadingTaskSource,
+ file_reading_thread_source: FileReadingThreadSource,
- /// A channel to hand out to tasks that need to respond to a message from the script task.
+ /// A channel to hand out to threads that need to respond to a message from the script thread.
control_chan: IpcSender<ConstellationControlMsg>,
- /// The port on which the constellation and layout tasks can communicate with the
- /// script task.
+ /// The port on which the constellation and layout threads can communicate with the
+ /// script thread.
control_port: Receiver<ConstellationControlMsg>,
/// For communicating load url messages to the constellation
@@ -541,7 +541,7 @@ pub struct ScriptTask {
mouse_over_targets: DOMRefCell<Vec<JS<Element>>>,
- /// List of pipelines that have been owned and closed by this script task.
+ /// List of pipelines that have been owned and closed by this script thread.
closed_pipelines: DOMRefCell<HashSet<PipelineId>>,
scheduler_chan: IpcSender<TimerEventRequest>,
@@ -551,12 +551,12 @@ pub struct ScriptTask {
content_process_shutdown_chan: IpcSender<()>,
}
-/// In the event of task failure, all data on the stack runs its destructor. However, there
+/// In the event of thread failure, all data on the stack runs its destructor. However, there
/// are no reachable, owning pointers to the DOM memory, so it never gets freed by default
-/// when the script task fails. The ScriptMemoryFailsafe uses the destructor bomb pattern
-/// to forcibly tear down the JS compartments for pages associated with the failing ScriptTask.
+/// when the script thread fails. The ScriptMemoryFailsafe uses the destructor bomb pattern
+/// to forcibly tear down the JS compartments for pages associated with the failing ScriptThread.
struct ScriptMemoryFailsafe<'a> {
- owner: Option<&'a ScriptTask>,
+ owner: Option<&'a ScriptThread>,
}
impl<'a> ScriptMemoryFailsafe<'a> {
@@ -564,7 +564,7 @@ impl<'a> ScriptMemoryFailsafe<'a> {
self.owner = None;
}
- fn new(owner: &'a ScriptTask) -> ScriptMemoryFailsafe<'a> {
+ fn new(owner: &'a ScriptThread) -> ScriptMemoryFailsafe<'a> {
ScriptMemoryFailsafe {
owner: Some(owner),
}
@@ -589,18 +589,18 @@ impl<'a> Drop for ScriptMemoryFailsafe<'a> {
}
}
-impl ScriptTaskFactory for ScriptTask {
- fn create_layout_channel(_phantom: Option<&mut ScriptTask>) -> OpaqueScriptLayoutChannel {
+impl ScriptThreadFactory for ScriptThread {
+ fn create_layout_channel(_phantom: Option<&mut ScriptThread>) -> OpaqueScriptLayoutChannel {
let (chan, port) = channel();
ScriptLayoutChan::new(chan, port)
}
- fn clone_layout_channel(_phantom: Option<&mut ScriptTask>, pair: &OpaqueScriptLayoutChannel)
+ fn clone_layout_channel(_phantom: Option<&mut ScriptThread>, pair: &OpaqueScriptLayoutChannel)
-> Box<Any + Send> {
box pair.sender() as Box<Any + Send>
}
- fn create(_phantom: Option<&mut ScriptTask>,
+ fn create(_phantom: Option<&mut ScriptThread>,
state: InitialScriptState,
layout_chan: &OpaqueScriptLayoutChannel,
load_data: LoadData) {
@@ -608,8 +608,8 @@ impl ScriptTaskFactory for ScriptTask {
let (script_chan, script_port) = channel();
let layout_chan = LayoutChan(layout_chan.sender());
let failure_info = state.failure_info;
- task::spawn_named_with_send_on_failure(format!("ScriptTask {:?}", state.id),
- task_state::SCRIPT,
+ thread::spawn_named_with_send_on_failure(format!("ScriptThread {:?}", state.id),
+ thread_state::SCRIPT,
move || {
PipelineNamespace::install(state.pipeline_namespace_id);
let roots = RootCollection::new();
@@ -620,27 +620,27 @@ impl ScriptTaskFactory for ScriptTask {
let parent_info = state.parent_info;
let mem_profiler_chan = state.mem_profiler_chan.clone();
let window_size = state.window_size;
- let script_task = ScriptTask::new(state,
+ let script_thread = ScriptThread::new(state,
script_port,
script_chan);
SCRIPT_TASK_ROOT.with(|root| {
- *root.borrow_mut() = Some(&script_task as *const _);
+ *root.borrow_mut() = Some(&script_thread as *const _);
});
- let mut failsafe = ScriptMemoryFailsafe::new(&script_task);
+ let mut failsafe = ScriptMemoryFailsafe::new(&script_thread);
let new_load = InProgressLoad::new(id, parent_info, layout_chan, window_size,
load_data.url.clone());
- script_task.start_page_load(new_load, load_data);
+ script_thread.start_page_load(new_load, load_data);
let reporter_name = format!("script-reporter-{}", id);
mem_profiler_chan.run_with_memory_reporting(|| {
- script_task.start();
- let _ = script_task.content_process_shutdown_chan.send(());
+ script_thread.start();
+ let _ = script_thread.content_process_shutdown_chan.send(());
}, reporter_name, channel_for_reporter, CommonScriptMsg::CollectReports);
- // This must always be the very last operation performed before the task completes
+ // This must always be the very last operation performed before the thread completes
failsafe.neuter();
}, ConstellationMsg::Failure(failure_info), const_chan);
}
@@ -691,8 +691,8 @@ unsafe extern "C" fn gc_slice_callback(_rt: *mut JSRuntime, progress: GCProgress
unsafe extern "C" fn debug_gc_callback(_rt: *mut JSRuntime, status: JSGCStatus, _data: *mut libc::c_void) {
match status {
- JSGCStatus::JSGC_BEGIN => task_state::enter(task_state::IN_GC),
- JSGCStatus::JSGC_END => task_state::exit(task_state::IN_GC),
+ JSGCStatus::JSGC_BEGIN => thread_state::enter(thread_state::IN_GC),
+ JSGCStatus::JSGC_END => thread_state::exit(thread_state::IN_GC),
}
}
@@ -710,37 +710,37 @@ pub struct CSSError {
msg: String
}
-impl ScriptTask {
+impl ScriptThread {
pub fn page_fetch_complete(id: PipelineId, subpage: Option<SubpageId>, metadata: Metadata)
-> Option<ParserRoot> {
SCRIPT_TASK_ROOT.with(|root| {
- let script_task = unsafe { &*root.borrow().unwrap() };
- script_task.handle_page_fetch_complete(id, subpage, metadata)
+ let script_thread = unsafe { &*root.borrow().unwrap() };
+ script_thread.handle_page_fetch_complete(id, subpage, metadata)
})
}
pub fn parsing_complete(id: PipelineId) {
SCRIPT_TASK_ROOT.with(|root| {
- let script_task = unsafe { &*root.borrow().unwrap() };
- script_task.handle_parsing_complete(id);
+ let script_thread = unsafe { &*root.borrow().unwrap() };
+ script_thread.handle_parsing_complete(id);
});
}
pub fn process_event(msg: CommonScriptMsg) {
SCRIPT_TASK_ROOT.with(|root| {
- if let Some(script_task) = *root.borrow() {
- let script_task = unsafe { &*script_task };
- script_task.handle_msg_from_script(MainThreadScriptMsg::Common(msg));
+ if let Some(script_thread) = *root.borrow() {
+ let script_thread = unsafe { &*script_thread };
+ script_thread.handle_msg_from_script(MainThreadScriptMsg::Common(msg));
}
});
}
- /// Creates a new script task.
+ /// Creates a new script thread.
pub fn new(state: InitialScriptState,
port: Receiver<MainThreadScriptMsg>,
chan: Sender<MainThreadScriptMsg>)
- -> ScriptTask {
- let runtime = ScriptTask::new_rt_and_cx();
+ -> ScriptThread {
+ let runtime = ScriptThread::new_rt_and_cx();
unsafe {
JS_SetWrapObjectCallbacks(runtime.rt(),
@@ -751,7 +751,7 @@ impl ScriptTask {
let (ipc_devtools_sender, ipc_devtools_receiver) = ipc::channel().unwrap();
let devtools_port = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_devtools_receiver);
- // Ask the router to proxy IPC messages from the image cache task to us.
+ // Ask the router to proxy IPC messages from the image cache thread to us.
let (ipc_image_cache_channel, ipc_image_cache_port) = ipc::channel().unwrap();
let image_cache_port =
ROUTER.route_ipc_receiver_to_new_mpsc_receiver(ipc_image_cache_port);
@@ -761,24 +761,24 @@ impl ScriptTask {
// Ask the router to proxy IPC messages from the control port to us.
let control_port = ROUTER.route_ipc_receiver_to_new_mpsc_receiver(state.control_port);
- ScriptTask {
+ ScriptThread {
page: DOMRefCell::new(None),
incomplete_loads: DOMRefCell::new(vec!()),
- image_cache_task: state.image_cache_task,
+ image_cache_thread: state.image_cache_thread,
image_cache_channel: ImageCacheChan(ipc_image_cache_channel),
image_cache_port: image_cache_port,
- resource_task: Arc::new(state.resource_task),
- storage_task: state.storage_task,
+ resource_thread: Arc::new(state.resource_thread),
+ storage_thread: state.storage_thread,
port: port,
chan: MainThreadScriptChan(chan.clone()),
- dom_manipulation_task_source: DOMManipulationTaskSource(chan.clone()),
- user_interaction_task_source: UserInteractionTaskSource(chan.clone()),
- networking_task_source: NetworkingTaskSource(chan.clone()),
- history_traversal_task_source: HistoryTraversalTaskSource(chan.clone()),
- file_reading_task_source: FileReadingTaskSource(chan),
+ dom_manipulation_thread_source: DOMManipulationThreadSource(chan.clone()),
+ user_interaction_thread_source: UserInteractionThreadSource(chan.clone()),
+ networking_thread_source: NetworkingThreadSource(chan.clone()),
+ history_traversal_thread_source: HistoryTraversalThreadSource(chan.clone()),
+ file_reading_thread_source: FileReadingThreadSource(chan),
control_chan: state.control_chan,
control_port: control_port,
@@ -851,7 +851,7 @@ impl ScriptTask {
self.js_runtime.cx()
}
- /// Starts the script task. After calling this method, the script task will loop receiving
+ /// Starts the script thread. After calling this method, the script thread will loop receiving
/// messages on its port.
pub fn start(&self) {
while self.handle_msgs() {
@@ -932,17 +932,17 @@ impl ScriptTask {
// child list yet, causing the find() to fail.
FromConstellation(ConstellationControlMsg::AttachLayout(
new_layout_info)) => {
- self.profile_event(ScriptTaskEventCategory::AttachLayout, || {
+ self.profile_event(ScriptThreadEventCategory::AttachLayout, || {
self.handle_new_layout(new_layout_info);
})
}
FromConstellation(ConstellationControlMsg::Resize(id, size)) => {
- self.profile_event(ScriptTaskEventCategory::Resize, || {
+ self.profile_event(ScriptThreadEventCategory::Resize, || {
self.handle_resize(id, size);
})
}
FromConstellation(ConstellationControlMsg::Viewport(id, rect)) => {
- self.profile_event(ScriptTaskEventCategory::SetViewport, || {
+ self.profile_event(ScriptThreadEventCategory::SetViewport, || {
self.handle_viewport(id, rect);
})
}
@@ -1037,52 +1037,52 @@ impl ScriptTask {
true
}
- fn categorize_msg(&self, msg: &MixedMessage) -> ScriptTaskEventCategory {
+ fn categorize_msg(&self, msg: &MixedMessage) -> ScriptThreadEventCategory {
match *msg {
MixedMessage::FromConstellation(ref inner_msg) => {
match *inner_msg {
ConstellationControlMsg::SendEvent(_, _) =>
- ScriptTaskEventCategory::DomEvent,
- _ => ScriptTaskEventCategory::ConstellationMsg
+ ScriptThreadEventCategory::DomEvent,
+ _ => ScriptThreadEventCategory::ConstellationMsg
}
},
- MixedMessage::FromDevtools(_) => ScriptTaskEventCategory::DevtoolsMsg,
- MixedMessage::FromImageCache(_) => ScriptTaskEventCategory::ImageCacheMsg,
+ MixedMessage::FromDevtools(_) => ScriptThreadEventCategory::DevtoolsMsg,
+ MixedMessage::FromImageCache(_) => ScriptThreadEventCategory::ImageCacheMsg,
MixedMessage::FromScript(ref inner_msg) => {
match *inner_msg {
MainThreadScriptMsg::Common(CommonScriptMsg::RunnableMsg(ref category, _)) =>
*category,
- _ => ScriptTaskEventCategory::ScriptEvent
+ _ => ScriptThreadEventCategory::ScriptEvent
}
},
- MixedMessage::FromScheduler(_) => ScriptTaskEventCategory::TimerEvent,
+ MixedMessage::FromScheduler(_) => ScriptThreadEventCategory::TimerEvent,
}
}
- fn profile_event<F, R>(&self, category: ScriptTaskEventCategory, f: F) -> R
+ fn profile_event<F, R>(&self, category: ScriptThreadEventCategory, f: F) -> R
where F: FnOnce() -> R {
if opts::get().profile_script_events {
let profiler_cat = match category {
- ScriptTaskEventCategory::AttachLayout => ProfilerCategory::ScriptAttachLayout,
- ScriptTaskEventCategory::ConstellationMsg => ProfilerCategory::ScriptConstellationMsg,
- ScriptTaskEventCategory::DevtoolsMsg => ProfilerCategory::ScriptDevtoolsMsg,
- ScriptTaskEventCategory::DocumentEvent => ProfilerCategory::ScriptDocumentEvent,
- ScriptTaskEventCategory::DomEvent => ProfilerCategory::ScriptDomEvent,
- ScriptTaskEventCategory::FileRead => ProfilerCategory::ScriptFileRead,
- ScriptTaskEventCategory::ImageCacheMsg => ProfilerCategory::ScriptImageCacheMsg,
- ScriptTaskEventCategory::InputEvent => ProfilerCategory::ScriptInputEvent,
- ScriptTaskEventCategory::NetworkEvent => ProfilerCategory::ScriptNetworkEvent,
- ScriptTaskEventCategory::Resize => ProfilerCategory::ScriptResize,
- ScriptTaskEventCategory::ScriptEvent => ProfilerCategory::ScriptEvent,
- ScriptTaskEventCategory::UpdateReplacedElement => {
+ ScriptThreadEventCategory::AttachLayout => ProfilerCategory::ScriptAttachLayout,
+ ScriptThreadEventCategory::ConstellationMsg => ProfilerCategory::ScriptConstellationMsg,
+ ScriptThreadEventCategory::DevtoolsMsg => ProfilerCategory::ScriptDevtoolsMsg,
+ ScriptThreadEventCategory::DocumentEvent => ProfilerCategory::ScriptDocumentEvent,
+ ScriptThreadEventCategory::DomEvent => ProfilerCategory::ScriptDomEvent,
+ ScriptThreadEventCategory::FileRead => ProfilerCategory::ScriptFileRead,
+ ScriptThreadEventCategory::ImageCacheMsg => ProfilerCategory::ScriptImageCacheMsg,
+ ScriptThreadEventCategory::InputEvent => ProfilerCategory::ScriptInputEvent,
+ ScriptThreadEventCategory::NetworkEvent => ProfilerCategory::ScriptNetworkEvent,
+ ScriptThreadEventCategory::Resize => ProfilerCategory::ScriptResize,
+ ScriptThreadEventCategory::ScriptEvent => ProfilerCategory::ScriptEvent,
+ ScriptThreadEventCategory::UpdateReplacedElement => {
ProfilerCategory::ScriptUpdateReplacedElement
}
- ScriptTaskEventCategory::StylesheetLoad => ProfilerCategory::ScriptStylesheetLoad,
- ScriptTaskEventCategory::SetViewport => ProfilerCategory::ScriptSetViewport,
- ScriptTaskEventCategory::TimerEvent => ProfilerCategory::ScriptTimerEvent,
- ScriptTaskEventCategory::WebSocketEvent => ProfilerCategory::ScriptWebSocketEvent,
- ScriptTaskEventCategory::WorkerEvent => ProfilerCategory::ScriptWorkerEvent,
+ ScriptThreadEventCategory::StylesheetLoad => ProfilerCategory::ScriptStylesheetLoad,
+ ScriptThreadEventCategory::SetViewport => ProfilerCategory::ScriptSetViewport,
+ ScriptThreadEventCategory::TimerEvent => ProfilerCategory::ScriptTimerEvent,
+ ScriptThreadEventCategory::WebSocketEvent => ProfilerCategory::ScriptWebSocketEvent,
+ ScriptThreadEventCategory::WorkerEvent => ProfilerCategory::ScriptWorkerEvent,
};
profile(profiler_cat, None, self.time_profiler_chan.clone(), f)
} else {
@@ -1167,12 +1167,12 @@ impl ScriptTask {
let pipeline_id = match source {
TimerSource::FromWindow(pipeline_id) => pipeline_id,
- TimerSource::FromWorker => panic!("Worker timeouts must not be sent to script task"),
+ TimerSource::FromWorker => panic!("Worker timeouts must not be sent to script thread"),
};
let page = self.root_page();
- let page = page.find(pipeline_id).expect("ScriptTask: received fire timer msg for a
- pipeline ID not associated with this script task. This is a bug.");
+ let page = page.find(pipeline_id).expect("ScriptThread: received fire timer msg for a
+ pipeline ID not associated with this script thread. This is a bug.");
let window = page.window();
window.handle_fire_timer(id);
@@ -1301,12 +1301,12 @@ impl ScriptTask {
content_process_shutdown_chan,
} = new_layout_info;
- let layout_pair = ScriptTask::create_layout_channel(None::<&mut ScriptTask>);
- let layout_chan = LayoutChan(*ScriptTask::clone_layout_channel(
- None::<&mut ScriptTask>,
+ let layout_pair = ScriptThread::create_layout_channel(None::<&mut ScriptThread>);
+ let layout_chan = LayoutChan(*ScriptThread::clone_layout_channel(
+ None::<&mut ScriptThread>,
&layout_pair).downcast::<Sender<layout_interface::Msg>>().unwrap());
- let layout_creation_info = NewLayoutTaskInfo {
+ let layout_creation_info = NewLayoutThreadInfo {
id: new_pipeline_id,
url: load_data.url.clone(),
is_parent: false,
@@ -1316,21 +1316,21 @@ impl ScriptTask {
failure: failure,
paint_chan: paint_chan,
script_chan: self.control_chan.clone(),
- image_cache_task: self.image_cache_task.clone(),
+ image_cache_thread: self.image_cache_thread.clone(),
layout_shutdown_chan: layout_shutdown_chan,
content_process_shutdown_chan: content_process_shutdown_chan,
};
let page = self.root_page();
- let parent_page = page.find(containing_pipeline_id).expect("ScriptTask: received a layout
+ let parent_page = page.find(containing_pipeline_id).expect("ScriptThread: received a layout
whose parent has a PipelineId which does not correspond to a pipeline in the script
- task's page tree. This is a bug.");
+ thread's page tree. This is a bug.");
let parent_window = parent_page.window();
- // Tell layout to actually spawn the task.
+ // Tell layout to actually spawn the thread.
parent_window.layout_chan()
.0
- .send(layout_interface::Msg::CreateLayoutTask(layout_creation_info))
+ .send(layout_interface::Msg::CreateLayoutThread(layout_creation_info))
.unwrap();
// Kick off the fetch for the new resource.
@@ -1353,7 +1353,7 @@ impl ScriptTask {
// https://html.spec.whatwg.org/multipage/#the-end step 7
let addr: Trusted<Document> = Trusted::new(doc, self.chan.clone());
let handler = box DocumentProgressHandler::new(addr.clone());
- self.chan.send(CommonScriptMsg::RunnableMsg(ScriptTaskEventCategory::DocumentEvent, handler)).unwrap();
+ self.chan.send(CommonScriptMsg::RunnableMsg(ScriptThreadEventCategory::DocumentEvent, handler)).unwrap();
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::LoadComplete(pipeline)).unwrap();
@@ -1433,7 +1433,7 @@ impl ScriptTask {
}
}
let path_seg = format!("url({})", urls.join(", "));
- reports.extend(ScriptTask::get_reports(self.get_cx(), path_seg));
+ reports.extend(ScriptThread::get_reports(self.get_cx(), path_seg));
reports_chan.send(reports);
}
@@ -1532,12 +1532,12 @@ impl ScriptTask {
}
/// We have gotten a window.close from script, which we pass on to the compositor.
- /// We do not shut down the script task now, because the compositor will ask the
+ /// We do not shut down the script thread now, because the compositor will ask the
/// constellation to shut down the pipeline, which will clean everything up
/// normally. If we do exit, we will tear down the DOM nodes, possibly at a point
/// where layout is still accessing them.
fn handle_exit_window_msg(&self, _: PipelineId) {
- debug!("script task handling exit window msg");
+ debug!("script thread handling exit window msg");
// TODO(tkuehn): currently there is only one window,
// so this can afford to be naive and just shut down the
@@ -1573,8 +1573,8 @@ impl ScriptTask {
document.send_title_to_compositor();
}
- /// Handles a request to exit the script task and shut down layout.
- /// Returns true if the script task should shut down and false otherwise.
+ /// Handles a request to exit the script thread and shut down layout.
+ /// Returns true if the script thread should shut down and false otherwise.
fn handle_exit_pipeline_msg(&self, id: PipelineId) -> bool {
self.closed_pipelines.borrow_mut().insert(id);
@@ -1586,7 +1586,7 @@ impl ScriptTask {
if let Some(idx) = idx {
let load = self.incomplete_loads.borrow_mut().remove(idx);
- // Tell the layout task to begin shutting down, and wait until it
+ // Tell the layout thread to begin shutting down, and wait until it
// processed this message.
let (response_chan, response_port) = channel();
let LayoutChan(chan) = load.layout_chan;
@@ -1619,7 +1619,7 @@ impl ScriptTask {
false
}
- /// Handles when layout task finishes all animation in one tick
+ /// Handles when layout thread finishes all animation in one tick
fn handle_tick_all_animations(&self, id: PipelineId) {
let page = get_page(&self.root_page(), id);
let document = page.document();
@@ -1647,7 +1647,7 @@ impl ScriptTask {
fn load(&self, metadata: Metadata, incomplete: InProgressLoad) -> ParserRoot {
let final_url = metadata.final_url.clone();
{
- // send the final url to the layout task.
+ // send the final url to the layout thread.
let LayoutChan(ref chan) = incomplete.layout_chan;
chan.send(layout_interface::Msg::SetFinalUrl(final_url.clone())).unwrap();
@@ -1655,7 +1655,7 @@ impl ScriptTask {
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ConstellationMsg::SetFinalUrl(incomplete.pipeline_id, final_url.clone())).unwrap();
}
- debug!("ScriptTask: loading {} on page {:?}", incomplete.url.serialize(), incomplete.pipeline_id);
+ debug!("ScriptThread: loading {} on page {:?}", incomplete.url.serialize(), incomplete.pipeline_id);
// We should either be initializing a root page or loading a child page of an
// existing one.
@@ -1663,12 +1663,12 @@ impl ScriptTask {
let frame_element = incomplete.parent_info.and_then(|(parent_id, subpage_id)| {
// The root page may not exist yet, if the parent of this frame
- // exists in a different script task.
+ // exists in a different script thread.
let borrowed_page = self.page.borrow();
// In the case a parent id exists but the matching page
// cannot be found, this means the page exists in a different
- // script task (due to origin) so it shouldn't be returned.
+ // script thread (due to origin) so it shouldn't be returned.
// TODO: window.parent will continue to return self in that
// case, which is wrong. We should be returning an object that
// denies access to most properties (per
@@ -1689,7 +1689,7 @@ impl ScriptTask {
} else if let Some((parent, _)) = incomplete.parent_info {
// We have a new child frame.
let parent_page = self.root_page();
- // TODO(gw): This find will fail when we are sharing script tasks
+ // TODO(gw): This find will fail when we are sharing script threads
// between cross origin iframes in the same TLD.
let parent_page = parent_page.find(parent)
.expect("received load for subpage with missing parent");
@@ -1702,14 +1702,14 @@ impl ScriptTask {
}
struct AutoPageRemover<'a> {
page: PageToRemove,
- script_task: &'a ScriptTask,
+ script_thread: &'a ScriptThread,
neutered: bool,
}
impl<'a> AutoPageRemover<'a> {
- fn new(script_task: &'a ScriptTask, page: PageToRemove) -> AutoPageRemover<'a> {
+ fn new(script_thread: &'a ScriptThread, page: PageToRemove) -> AutoPageRemover<'a> {
AutoPageRemover {
page: page,
- script_task: script_task,
+ script_thread: script_thread,
neutered: false,
}
}
@@ -1722,9 +1722,9 @@ impl ScriptTask {
fn drop(&mut self) {
if !self.neutered {
match self.page {
- PageToRemove::Root => *self.script_task.page.borrow_mut() = None,
+ PageToRemove::Root => *self.script_thread.page.borrow_mut() = None,
PageToRemove::Child(id) => {
- self.script_task.root_page().remove(id).unwrap();
+ self.script_thread.root_page().remove(id).unwrap();
}
}
}
@@ -1738,11 +1738,11 @@ impl ScriptTask {
};
let mut page_remover = AutoPageRemover::new(self, page_to_remove);
let MainThreadScriptChan(ref sender) = self.chan;
- let DOMManipulationTaskSource(ref dom_sender) = self.dom_manipulation_task_source;
- let UserInteractionTaskSource(ref user_sender) = self.user_interaction_task_source;
- let NetworkingTaskSource(ref network_sender) = self.networking_task_source;
- let HistoryTraversalTaskSource(ref history_sender) = self.history_traversal_task_source;
- let FileReadingTaskSource(ref file_sender) = self.file_reading_task_source;
+ let DOMManipulationThreadSource(ref dom_sender) = self.dom_manipulation_thread_source;
+ let UserInteractionThreadSource(ref user_sender) = self.user_interaction_thread_source;
+ let NetworkingThreadSource(ref network_sender) = self.networking_thread_source;
+ let HistoryTraversalThreadSource(ref history_sender) = self.history_traversal_thread_source;
+ let FileReadingThreadSource(ref file_sender) = self.file_reading_thread_source;
let (ipc_timer_event_chan, ipc_timer_event_port) = ipc::channel().unwrap();
ROUTER.route_ipc_receiver_to_mpsc_sender(ipc_timer_event_port,
@@ -1752,16 +1752,16 @@ impl ScriptTask {
let window = Window::new(self.js_runtime.clone(),
page.clone(),
MainThreadScriptChan(sender.clone()),
- DOMManipulationTaskSource(dom_sender.clone()),
- UserInteractionTaskSource(user_sender.clone()),
- NetworkingTaskSource(network_sender.clone()),
- HistoryTraversalTaskSource(history_sender.clone()),
- FileReadingTaskSource(file_sender.clone()),
+ DOMManipulationThreadSource(dom_sender.clone()),
+ UserInteractionThreadSource(user_sender.clone()),
+ NetworkingThreadSource(network_sender.clone()),
+ HistoryTraversalThreadSource(history_sender.clone()),
+ FileReadingThreadSource(file_sender.clone()),
self.image_cache_channel.clone(),
self.compositor.borrow_mut().clone(),
- self.image_cache_task.clone(),
- self.resource_task.clone(),
- self.storage_task.clone(),
+ self.image_cache_thread.clone(),
+ self.resource_thread.clone(),
+ self.storage_thread.clone(),
self.mem_profiler_chan.clone(),
self.devtools_chan.clone(),
self.constellation_chan.clone(),
@@ -1788,7 +1788,7 @@ impl ScriptTask {
_ => None
};
- let loader = DocumentLoader::new_with_task(self.resource_task.clone(),
+ let loader = DocumentLoader::new_with_thread(self.resource_thread.clone(),
Some(page.pipeline()),
Some(incomplete.url.clone()));
@@ -1903,7 +1903,7 @@ impl ScriptTask {
let rect = element.upcast::<Node>().get_bounding_content_box();
// In order to align with element edges, we snap to unscaled pixel boundaries, since the
- // paint task currently does the same for drawing elements. This is important for pages
+ // paint thread currently does the same for drawing elements. This is important for pages
// that require pixel perfect scroll positioning for proper display (like Acid2). Since we
// don't have the device pixel ratio here, this might not be accurate, but should work as
// long as the ratio is a whole number. Once #8275 is fixed this should actually take into
@@ -2107,7 +2107,7 @@ impl ScriptTask {
let subpage = incomplete.parent_info.clone().map(|p| p.1);
let script_chan = self.chan.clone();
- let resource_task = self.resource_task.clone();
+ let resource_thread = self.resource_thread.clone();
let context = Arc::new(Mutex::new(ParserContext::new(id, subpage, script_chan.clone(),
load_data.url.clone())));
@@ -2127,7 +2127,7 @@ impl ScriptTask {
load_data.url = url!("about:blank");
}
- resource_task.send(ControlMsg::Load(NetLoadData {
+ resource_thread.send(ControlMsg::Load(NetLoadData {
context: LoadContext::Browsing,
url: load_data.url,
method: load_data.method,
@@ -2198,7 +2198,7 @@ impl ScriptTask {
}
}
-impl Drop for ScriptTask {
+impl Drop for ScriptThread {
fn drop(&mut self) {
SCRIPT_TASK_ROOT.with(|root| {
*root.borrow_mut() = None;
@@ -2211,7 +2211,7 @@ fn shut_down_layout(page_tree: &Rc<Page>) {
let mut channels = vec!();
for page in page_tree.iter() {
- // Tell the layout task to begin shutting down, and wait until it
+ // Tell the layout thread to begin shutting down, and wait until it
// processed this message.
let (response_chan, response_port) = channel();
let window = page.window();
@@ -2230,15 +2230,15 @@ fn shut_down_layout(page_tree: &Rc<Page>) {
page.set_frame(None);
}
- // Destroy the layout task. If there were node leaks, layout will now crash safely.
+ // Destroy the layout thread. If there were node leaks, layout will now crash safely.
for chan in channels {
chan.send(layout_interface::Msg::ExitNow).ok();
}
}
pub fn get_page(page: &Rc<Page>, pipeline_id: PipelineId) -> Rc<Page> {
- page.find(pipeline_id).expect("ScriptTask: received an event \
- message for a layout channel that is not associated with this script task.\
+ page.find(pipeline_id).expect("ScriptThread: received an event \
+ message for a layout channel that is not associated with this script thread.\
This is a bug.")
}
diff --git a/components/script/timers.rs b/components/script/timers.rs
index 7e164bbe5eb..786cfbf4c6f 100644
--- a/components/script/timers.rs
+++ b/components/script/timers.rs
@@ -48,7 +48,7 @@ pub struct ActiveTimers {
/// - a timer was added with an earlier callback time. In this case the
/// original timer is rescheduled when it is the next one to get called.
expected_event_id: Cell<TimerEventId>,
- /// The nesting level of the currently executing timer task or 0.
+ /// The nesting level of the currently executing timer thread or 0.
nesting_level: Cell<u32>,
}
diff --git a/components/script/webdriver_handlers.rs b/components/script/webdriver_handlers.rs
index 2ae4931937d..0c9831bf3f6 100644
--- a/components/script/webdriver_handlers.rs
+++ b/components/script/webdriver_handlers.rs
@@ -29,7 +29,7 @@ use js::jsval::UndefinedValue;
use msg::constellation_msg::{PipelineId, WindowSizeData};
use msg::webdriver_msg::{WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverJSValue};
use page::Page;
-use script_task::get_page;
+use script_thread::get_page;
use std::rc::Rc;
use url::Url;
use util::str::DOMString;