Issue #9561 continued - renamed *_thread_source to *_task_source in global.rs and related files

This commit is contained in:
Kamil Muszyński 2016-02-17 21:25:12 +01:00
parent 61f09cce4e
commit c6dfd7e2fa
6 changed files with 19 additions and 19 deletions

View file

@ -142,7 +142,7 @@ impl<'a> GlobalRef<'a> {
/// `ScriptChan` used to send messages to the event loop of this global's /// `ScriptChan` used to send messages to the event loop of this global's
/// thread. /// thread.
pub fn dom_manipulation_thread_source(&self) -> Box<ScriptChan + Send> { pub fn dom_manipulation_task_source(&self) -> Box<ScriptChan + Send> {
match *self { match *self {
GlobalRef::Window(ref window) => window.dom_manipulation_task_source(), GlobalRef::Window(ref window) => window.dom_manipulation_task_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(), GlobalRef::Worker(ref worker) => worker.script_chan(),
@ -151,7 +151,7 @@ impl<'a> GlobalRef<'a> {
/// `ScriptChan` used to send messages to the event loop of this global's /// `ScriptChan` used to send messages to the event loop of this global's
/// thread. /// thread.
pub fn user_interaction_thread_source(&self) -> Box<ScriptChan + Send> { pub fn user_interaction_task_source(&self) -> Box<ScriptChan + Send> {
match *self { match *self {
GlobalRef::Window(ref window) => window.user_interaction_task_source(), GlobalRef::Window(ref window) => window.user_interaction_task_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(), GlobalRef::Worker(ref worker) => worker.script_chan(),
@ -160,7 +160,7 @@ impl<'a> GlobalRef<'a> {
/// `ScriptChan` used to send messages to the event loop of this global's /// `ScriptChan` used to send messages to the event loop of this global's
/// thread. /// thread.
pub fn networking_thread_source(&self) -> Box<ScriptChan + Send> { pub fn networking_task_source(&self) -> Box<ScriptChan + Send> {
match *self { match *self {
GlobalRef::Window(ref window) => window.networking_task_source(), GlobalRef::Window(ref window) => window.networking_task_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(), GlobalRef::Worker(ref worker) => worker.script_chan(),
@ -169,7 +169,7 @@ impl<'a> GlobalRef<'a> {
/// `ScriptChan` used to send messages to the event loop of this global's /// `ScriptChan` used to send messages to the event loop of this global's
/// thread. /// thread.
pub fn history_traversal_thread_source(&self) -> Box<ScriptChan + Send> { pub fn history_traversal_task_source(&self) -> Box<ScriptChan + Send> {
match *self { match *self {
GlobalRef::Window(ref window) => window.history_traversal_task_source(), GlobalRef::Window(ref window) => window.history_traversal_task_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(), GlobalRef::Worker(ref worker) => worker.script_chan(),
@ -178,7 +178,7 @@ impl<'a> GlobalRef<'a> {
/// `ScriptChan` used to send messages to the event loop of this global's /// `ScriptChan` used to send messages to the event loop of this global's
/// thread. /// thread.
pub fn file_reading_thread_source(&self) -> Box<ScriptChan + Send> { pub fn file_reading_task_source(&self) -> Box<ScriptChan + Send> {
match *self { match *self {
GlobalRef::Window(ref window) => window.file_reading_task_source(), GlobalRef::Window(ref window) => window.file_reading_task_source(),
GlobalRef::Worker(ref worker) => worker.script_chan(), GlobalRef::Worker(ref worker) => worker.script_chan(),

View file

@ -358,10 +358,10 @@ impl FileReader {
let load_data = ReadMetaData::new(String::from(type_), label.map(String::from), function); let load_data = ReadMetaData::new(String::from(type_), label.map(String::from), function);
let fr = Trusted::new(self, global.file_reading_thread_source()); let fr = Trusted::new(self, global.file_reading_task_source());
let gen_id = self.generation_id.get(); let gen_id = self.generation_id.get();
let script_chan = global.file_reading_thread_source(); let script_chan = global.file_reading_task_source();
spawn_named("file reader async operation".to_owned(), move || { spawn_named("file reader async operation".to_owned(), move || {
perform_annotated_read_operation(gen_id, load_data, blob_contents, fr, script_chan) perform_annotated_read_operation(gen_id, load_data, blob_contents, fr, script_chan)

View file

@ -154,7 +154,7 @@ impl Storage {
let global_root = self.global(); let global_root = self.global();
let global_ref = global_root.r(); let global_ref = global_root.r();
let main_script_chan = global_ref.as_window().main_thread_script_chan(); let main_script_chan = global_ref.as_window().main_thread_script_chan();
let script_chan = global_ref.dom_manipulation_thread_source(); let script_chan = global_ref.dom_manipulation_task_source();
let trusted_storage = Trusted::new(self, script_chan); let trusted_storage = Trusted::new(self, script_chan);
main_script_chan.send(MainThreadScriptMsg::MainThreadRunnableMsg( main_script_chan.send(MainThreadScriptMsg::MainThreadRunnableMsg(
box StorageEventRunnable::new(trusted_storage, key, old_value, new_value))).unwrap(); box StorageEventRunnable::new(trusted_storage, key, old_value, new_value))).unwrap();

View file

@ -237,7 +237,7 @@ impl WebSocket {
// Step 7. // Step 7.
let ws = WebSocket::new(global, resource_url.clone()); let ws = WebSocket::new(global, resource_url.clone());
let address = Trusted::new(ws.r(), global.networking_thread_source()); let address = Trusted::new(ws.r(), global.networking_task_source());
let connect_data = WebSocketConnectData { let connect_data = WebSocketConnectData {
resource_url: resource_url.clone(), resource_url: resource_url.clone(),
@ -264,7 +264,7 @@ impl WebSocket {
*ws.sender.borrow_mut() = Some(dom_action_sender); *ws.sender.borrow_mut() = Some(dom_action_sender);
let moved_address = address.clone(); let moved_address = address.clone();
let sender = global.networking_thread_source(); let sender = global.networking_task_source();
thread::spawn(move || { thread::spawn(move || {
while let Ok(event) = dom_event_receiver.recv() { while let Ok(event) = dom_event_receiver.recv() {
match event { match event {
@ -307,7 +307,7 @@ impl WebSocket {
}; };
let global = self.global(); let global = self.global();
let chan = global.r().networking_thread_source(); let chan = global.r().networking_task_source();
let address = Trusted::new(self, chan.clone()); let address = Trusted::new(self, chan.clone());
match data_byte_len.checked_add(self.buffered_amount.get()) { match data_byte_len.checked_add(self.buffered_amount.get()) {
@ -433,7 +433,7 @@ impl WebSocketMethods for WebSocket {
self.ready_state.set(WebSocketRequestState::Closing); self.ready_state.set(WebSocketRequestState::Closing);
let global = self.global(); let global = self.global();
let sender = global.r().networking_thread_source(); let sender = global.r().networking_task_source();
let address = Trusted::new(self, sender.clone()); let address = Trusted::new(self, sender.clone());
fail_the_websocket_connection(address, sender); fail_the_websocket_connection(address, sender);
} }
@ -467,7 +467,7 @@ impl Runnable for ConnectionEstablishedTask {
// Step 1: Protocols. // Step 1: Protocols.
if !self.protocols.is_empty() && self.headers.get::<WebSocketProtocol>().is_none() { if !self.protocols.is_empty() && self.headers.get::<WebSocketProtocol>().is_none() {
let sender = global.r().networking_thread_source(); let sender = global.r().networking_task_source();
fail_the_websocket_connection(self.addr, sender); fail_the_websocket_connection(self.addr, sender);
return; return;
} }

View file

@ -71,7 +71,7 @@ impl Worker {
let (sender, receiver) = channel(); let (sender, receiver) = channel();
let worker = Worker::new(global, sender.clone()); let worker = Worker::new(global, sender.clone());
let worker_ref = Trusted::new(worker.r(), global.dom_manipulation_thread_source()); let worker_ref = Trusted::new(worker.r(), global.dom_manipulation_task_source());
let worker_id = global.get_next_worker_id(); let worker_id = global.get_next_worker_id();
let (devtools_sender, devtools_receiver) = ipc::channel().unwrap(); let (devtools_sender, devtools_receiver) = ipc::channel().unwrap();
@ -102,7 +102,7 @@ impl Worker {
}; };
DedicatedWorkerGlobalScope::run_worker_scope( DedicatedWorkerGlobalScope::run_worker_scope(
init, worker_url, global.pipeline(), devtools_receiver, worker_ref, init, worker_url, global.pipeline(), devtools_receiver, worker_ref,
global.dom_manipulation_thread_source(), sender, receiver); global.dom_manipulation_task_source(), sender, receiver);
Ok(worker) Ok(worker)
} }
@ -141,7 +141,7 @@ impl WorkerMethods for Worker {
// https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage // https://html.spec.whatwg.org/multipage/#dom-dedicatedworkerglobalscope-postmessage
fn PostMessage(&self, cx: *mut JSContext, message: HandleValue) -> ErrorResult { fn PostMessage(&self, cx: *mut JSContext, message: HandleValue) -> ErrorResult {
let data = try!(StructuredCloneData::write(cx, message)); let data = try!(StructuredCloneData::write(cx, message));
let address = Trusted::new(self, self.global().r().dom_manipulation_thread_source()); let address = Trusted::new(self, self.global().r().dom_manipulation_task_source());
self.sender.send((address, WorkerScriptMsg::DOMMessage(data))).unwrap(); self.sender.send((address, WorkerScriptMsg::DOMMessage(data))).unwrap();
Ok(()) Ok(())
} }

View file

@ -1034,7 +1034,7 @@ impl XMLHttpRequest {
// This will cancel all previous timeouts // This will cancel all previous timeouts
let global = self.global(); let global = self.global();
let callback = ScheduledXHRTimeout { let callback = ScheduledXHRTimeout {
xhr: Trusted::new(self, global.r().networking_thread_source()), xhr: Trusted::new(self, global.r().networking_task_source()),
generation_id: self.generation_id.get(), generation_id: self.generation_id.get(),
}; };
let duration = Length::new(duration_ms as u64); let duration = Length::new(duration_ms as u64);
@ -1234,7 +1234,7 @@ impl XMLHttpRequest {
Ok(req) => req, Ok(req) => req,
}; };
let xhr = Trusted::new(self, global.networking_thread_source()); let xhr = Trusted::new(self, global.networking_task_source());
let context = Arc::new(Mutex::new(XHRContext { let context = Arc::new(Mutex::new(XHRContext {
xhr: xhr, xhr: xhr,
@ -1248,7 +1248,7 @@ impl XMLHttpRequest {
let (tx, rx) = global.new_script_pair(); let (tx, rx) = global.new_script_pair();
(tx, Some(rx)) (tx, Some(rx))
} else { } else {
(global.networking_thread_source(), None) (global.networking_task_source(), None)
}; };
let resource_thread = global.resource_thread(); let resource_thread = global.resource_thread();