aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorthiagopnts <thiagopnts@gmail.com>2014-12-23 15:20:40 -0200
committerthiagopnts <thiagopnts@gmail.com>2014-12-23 23:53:38 -0200
commit271aa277e90ffeb1e060a2aac6f05429ded55c38 (patch)
treec0faf94d8bcd1bbc3c9293a9627b992ce1acfca4 /components/script/script_task.rs
parentc92a7898b47ded1382221fc78526b87bfa9bd897 (diff)
downloadservo-271aa277e90ffeb1e060a2aac6f05429ded55c38.tar.gz
servo-271aa277e90ffeb1e060a2aac6f05429ded55c38.zip
Replace XHR events for generic ones in ScriptTask
fixup! Replace XHR events for generic ones in ScriptTask fixup! Replace XHR events for generic ones in ScriptTask
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs17
1 files changed, 8 insertions, 9 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index dd5a3385ef8..42ab8b11307 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -26,7 +26,6 @@ use dom::keyboardevent::KeyboardEvent;
use dom::node::{mod, Node, NodeHelpers, NodeDamage, NodeTypeId};
use dom::window::{Window, WindowHelpers};
use dom::worker::{Worker, TrustedWorkerAddress};
-use dom::xmlhttprequest::{TrustedXHRAddress, XMLHttpRequest, XHRProgress};
use parse::html::{HTMLInput, parse_html};
use layout_interface::{ScriptLayoutChan, LayoutChan, ReflowGoal, ReflowQueryType};
use layout_interface;
@@ -86,6 +85,10 @@ pub enum TimerSource {
FromWorker
}
+pub trait Runnable {
+ fn handler(&self);
+}
+
/// Messages used to control script event loops, such as ScriptTask and
/// DedicatedWorkerGlobalScope.
pub enum ScriptMsg {
@@ -105,10 +108,6 @@ pub enum ScriptMsg {
/// Notifies the script that a window associated with a particular pipeline
/// should be closed (only dispatched to ScriptTask).
ExitWindow(PipelineId),
- /// Notifies the script of progress on a fetch (dispatched to all tasks).
- XHRProgress(TrustedXHRAddress, XHRProgress),
- /// Releases one reference to the XHR object (dispatched to all tasks).
- XHRRelease(TrustedXHRAddress),
/// Message sent through Worker.postMessage (only dispatched to
/// DedicatedWorkerGlobalScope).
DOMMessage(*mut u64, size_t),
@@ -116,6 +115,8 @@ pub enum ScriptMsg {
WorkerPostMessage(TrustedWorkerAddress, *mut u64, size_t),
/// Releases one reference to the Worker object (dispatched to all tasks).
WorkerRelease(TrustedWorkerAddress),
+ /// Generic message that encapsulates event handling.
+ RunnableMsg(Box<Runnable+Send>),
}
/// Encapsulates internal communication within the script task.
@@ -571,16 +572,14 @@ impl ScriptTask {
self.handle_navigate_msg(direction),
ScriptMsg::ExitWindow(id) =>
self.handle_exit_window_msg(id),
- ScriptMsg::XHRProgress(addr, progress) =>
- XMLHttpRequest::handle_progress(addr, progress),
- ScriptMsg::XHRRelease(addr) =>
- XMLHttpRequest::handle_release(addr),
ScriptMsg::DOMMessage(..) =>
panic!("unexpected message"),
ScriptMsg::WorkerPostMessage(addr, data, nbytes) =>
Worker::handle_message(addr, data, nbytes),
ScriptMsg::WorkerRelease(addr) =>
Worker::handle_release(addr),
+ ScriptMsg::RunnableMsg(runnable) =>
+ runnable.handler(),
}
}